C++ multithreaded SOCKET communication research log
Recently, I have been studying C++ program. The basic idea is as follows: as a service receiver, monitor 4500 port. When there is a connection, create a new thread and realize data receiving and sending in the thread. Idea 2: Use the selected mode to match data and send data once. The following code is not complete. Pragma comment(lib,"ws2_32") #include <stdio.h> #include <iostream.h> #include <stdlib.h> #include <conio.h> #include <windows.h> int signal[100]; // Create a socket that connects to the trace symbol. int undernum = 1; DWORD WINAPI run(LPVOID p) {printf("three%d run.. \n",p); //Sleep((DWORD)p*3000); //return (DWORD)p; while(1){ //CODES } } int main() { WSADATA wsaData; HANDLE three[255]; // thread DWORD dwThId[255]; Int undernum=0; // sockVersion = MAKEWORD(2, 2); // Load the Winsock library if(WSAStartup(sockVersion, &wsaData)! = 0) return 0; SOCKET sListen = SOCKET (AF_INET, SOCK_STRECopy the code