FD_ACCEPT and FD_CONNECT which fires first, I said look FD_ACCEPT trigger first, but why do I always jump to FD_CONNECT when debugging?
CodePudding user response:
You concept mistaken Based on the TCP (connection-oriented) socket programming, divided into client and server, The client process is as follows: (1) to create a socket (socket) (2) send a connection request to the server (connect) (3) and server communicate (send/recv) (4) close the socket The server process is as follows: (1) to create a socket (socket) (2) to bind a socket to a local address and port (bind) (3) to the socket set to monitor mode, ready to receive the client request (listen) (4) waiting for customer request; When the request arrives, accept connection requests and returns a new corresponding to the connection socket (accept) (5) with return the socket and the client communicate (send/recv) (6) return, waiting for another client request, Close the socket (7),