Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- DWORD WINAPI HandleConnection(LPVOID sock)
- {
- SOCKET client = INVALID_SOCKET;
- HANDLE hFile = NULL;
- char buffer[200];
- int recv_bytes = 0;
- DWORD bytes_written = 0;
- client = *(SOCKET *)sock;
- SendData(client, "Hello!\n");
- while (TRUE)
- {
- ZeroMemory(buffer, sizeof(buffer));
- recv_bytes = recv(client, buffer, sizeof(buffer), 0);
- if (recv_bytes > 0)
- {
- if (MyCmp(buffer, "exit"))
- {
- printf("command: exit\n");
- break;
- }
- else if (MyCmp(buffer, "help"))
- {
- printf("command: help\n");
- SendData(client, "hello\r\n");
- }
- }
- else break;
- }
- closesocket(client);
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement