#include <iostream> #include <WinSock2.h> comment(lib, "ws2_32") main( argc, ** WSAStartup(WINSOCK_VERSION, & USHORT uPort = SOCKET sListen = (INVALID_SOCKET == cout << << GetLastError() << sin.sin_family = sin.sin_port = sin.sin_addr.S_un.S_addr = (SOCKET_ERROR == bind(sListen, (PSOCKADDR)&sin, cout << << WSAGetLastError() << (SOCKET_ERROR == listen(sListen, cout << << WSAGetLastError() << FD_ZERO(& FD_SET(sListen, & fd_set fdRead = iRet = (, & (iRet > (size_t i = ; i < fdSocket.fd_count; i++ (FD_ISSET(fdSocket.fd_array[i], & (fdSocket.fd_array[i] == (fdSocket.fd_count < iAddrLen = SOCKET sNew = accept(sListen, (PSOCKADDR)&addrRemote, & FD_SET(sNew, & cout << << inet_ntoa(addrRemote.sin_addr) << << cout << << szText[ iRecv = recv(fdSocket.fd_array[i], szText, strlen(szText), (iRecv > szText[iRecv] = cout << << szText << FD_CLR(fdSocket.fd_array[i], & cout << << WSAGetLastError() << }