#include #include #include #include #include #include using namespace std; int main(){ #define DEFAULT_BUFLEN 512 WSAData wsadat; SOCKET sock; int result; char ip[100]; int port; int error = WSAGetLastError(); string sendbuf; string recvbuf[DEFAULT_BUFLEN]; cout<<"~~~~~YourCPPHero Chat client~~~~~"<>sendbuf; result = send(sock, sendbuf, (intr)sizeof(sendbuf), MSG_OOB); if(result == SOCKET_ERROR){ printf("send() failed: %d\n", WSAGetLastError()); system("PAUSE"); goto clean; } do{ result = recv(sock,recvbuf, sizeof(recvbuf), MSG_PEEK); if(result >0)printf("Bytes Recieved: %d\n", result); else if (result ==0)printf("Connection Closed\n"); printf("recv failed: %ld\n", WSAGetLastError()); cout<0); result = shutdown(sock, SD_SEND); if(result == SOCKET_ERROR){ printf("shutdown() returned error: %d\n", WSAGetLastError); goto clean; } system("PAUSE"); clean: WSACleanup(); closesocket(sock); }