|
用ACE来发文件送数据:
发送:- ifstream i;
- i.open("ACE.dll");
- char buffer[1024];
-
- while(!i.eof())
- {
- printf("发送中。。。。");
- i.read(buffer,1024);
- client_stream_.send_n(buffer,1024, 0);
-
- }
- i.close();
- if (client_stream_.close () == -1)
- ACE_ERROR_RETURN ((LM_ERROR,"(%P|%t) %p\n","close"),-1);
- 接收:
- ofstream out;
- out.open("ACE1.dll");
- char buffer[1024];
- while(new_stream_.recv_n(buffer, 1024, 0)!=-1)
- {
- printf("接收中。。。");
- out.write(buffer,1024);
- }
- out.close();
- printf("接收完毕");
- if (new_stream_.close () == -1)
- ACE_ERROR ((LM_ERROR, "%p\n", "close"));
- return 0;
复制代码 结果在接收中无法判断是否接收完毕 |
|