ProgrammingThis forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
I've seen plenty of source code for an endless loop that constantly checks the SocketID for data/connections on a listening port, but is there anyway to do asyncronous sockets like Windows has? Like, where would I pass a CallBack pointer to?
Basically I want to have a single suspended thread bound/listening on port 9998, when a user connects, I would like to create for them a suspended thread, which will have a callback pointer to within the thread for the socket just for them. This is NOT for interactive gaming, the chat clients don't constantly have to send data. Therefore, having a suspended thread just waiting for a packet/async call to within the thread when they finally do send data, would prevent alot of CPU from being wasted in the meantime. I believe this beats constantly looping to check a socket for data/incoming connections.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.