C++实现文件传输代码
部分代码 **********Receivefile client.cpp *************/ #include #include #pragma comment(lib,"ws2_32.lib") void main() { WSADATA wsaData; int iResult=WSAStartup(MAKEWORD(2,2),&wsaData); if (iResult!=NO_ERROR) printf("Error at WSAStartup()\n"); SOCKET client; client=socket(AF_INET,SOCKET_STREAM,IPPROTO_TCP); if(client==INVALID_SOCKET){ printf("Error at socket():%ld\n",WSAGetLastError()); WSACleanup(); return; }
暂无评论