Sign in to follow this  
Leaguefun

Fight against WSAWOULDBLOCK

Recommended Posts

I created a multithread server which using TCP to broadcast knocking message to all client by 33 times a second (Each knocking message has about 1024bytes in size). After about 10 or above clients had been connected to my server (I'm using one machine to start all clients), WSAWOULDBLOCK erro message will be received continuously from my server after each sendto function. Is TCP protocol is not good to be used in my situation ? or do I missing any important issue for do this kind of method ?

Share this post


Link to post
Share on other sites
Sending 33Kb/s to each client is only a testing purpose. After there have around 10 clients connected to server, it got error message for WSAWOULDBLOCK after each sendto() statement. I'd try to detect those socket which can be written by using select(), even i got that socket is ready for being wrote, during the next sendto() statement I still got WSAWOULDBLOCK. I don't know what's the case and how to deal with this situation ?

Share this post


Link to post
Share on other sites
Try reducing the # of times per second to something more reasonable, like 2-5 (10 max). Also, 1KB every send is excessive. Try to reduce that, as well (delta compression, use smaller types (like BYTE instead of integer, or store 8 bools into a byte instead of using 8 bytes) ).

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this