CSocket文件传输 分段传输的关键代码

摘要: 分段传输的关键代码 struct FILEINFO { int fileLength;//文件长度 char fileName[100];//文件名 }; 服务器: CFileDialog fileDialog(TRUE);//选择文件 if (fileDialog.DoModal()==IDOK) { CString filename = fileDialog.GetPathName();//文件路径 CString name = fileDialog.GetFileName();//文件名字 //发送文件 CFile file; if(... 阅读全文
posted @ 2011-08-24 16:44 DoubleSnake 阅读(2894) 评论(0) 推荐(0)

CSocket基本流程

摘要: void SendFile(){#define PORT 34000 /// Select any free port you wishAfxSocketInit(NULL);CSocket sockSrvr;sockSrvr.Create(PORT); // Creates our server socketsockSrvr.Listen(); // Start listening for the client at PORTCSocket sockRecv;sockSrvr.Accept(sockRecv); // Use another CSocket to accept the con 阅读全文
posted @ 2011-08-24 11:45 DoubleSnake 阅读(658) 评论(0) 推荐(0)