Fight against WSAWOULDBLOCK

Started by
4 comments, last by Leaguefun 19 years, 5 months ago
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 ?
Advertisement
What's the upload limit on your modem?
You're sending 33KB/s to each client?

Slightly related to your problem (you must ALWAYS use queues when dealing with nonblocking sockets), but isn't that A BIT MUCH?
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 ?
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) ).
Is TCP protocol may not be used for rapidly data transfer ? How to be done for commercial multi-player server ?

This topic is closed to new replies.

Advertisement