Archived

This topic is now archived and is closed to further replies.

help for a newbie

This topic is 5584 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

I am still hazy on exactly how WinSock works. I thought it would be cool to write a little chat server, and a little chat client program. I just want simple, basically all in a console. But as for the server, I want to be able to tell if someone wants to join my chat server. It seems that the accept function, or whatever crucial part of someone connecting, blocks program flow, thus stopping the chat. Should the server be a win32 application with the custom message handling? If this were to be a major processing thing, would it be better for it to be console? I am still confused, and any help would be nice. I have looked at many tutorials, but I will reread and reread until I can do this. Thanks for your time! - Be the change you want to see in the world.

Share this post


Link to post
Share on other sites
You could make the server socket non-blocking. Then if there are no connections pending, the accept call will return immediately with WSAEWOULDBLOCK (I think).
You can make a socket nonblocking with ioctlsocket()

Share this post


Link to post
Share on other sites