My code hangs on the following line of code:
CSocket and LSocket are both of type SOCKET.Code:CSocket = accept(LSocket, NULL, NULL);
LSocket is the listening socket. It gets created to listen on a specific port for incoming connections.
When accept() is called, CSocket will be setup to handle any incoming connection that LSocket receives. However, if no incoming connection is detected by LSocket, then the code will "hang" on the accept() function until there IS a connection? And, essentially, once a connection is received, LSocket becomes useless (in this example), which is why it's closed, and any further contact between the connection will be done through CSocket?
Sorry, that's the least confusing way I could find to write it out. I'm coming at this from Winsock under Visual Basic, and boy, can I say that it was a whole lot easier
Search saved me:
Dumb question time - Winsock & accept()
I'm pretty sure I'm understanding it correctly now...
Does this mean, if I want multiple connections, coming in at any time, I'll need multiple threads?