c++ - Does listen() run continuously or do I need to loop it to keep receiving connections on a socket? -
i'm running client , server on same machine using loopback address learning purposes yet "server" code seems fly listen() , hangs on connect(). listen() need in endless loop keep receiving connections?
how determine connection made/in queue if listen() returns 0 when haven't made connection yet?
i have accept() call following code hangs on spot. have debug statements right before , after , never gets past accept().
on other end client code seems connect() fine (doesn't throw error) , appears write , complete though server code never gets connection.
the listen function defines backlog. need call once.
then use accept receive incoming connection. best deal promptly , go around again accept.
Comments
Post a Comment