Skip to main content
GameDev.net gamedev.net
🔒 Locked

Fight against WSAWOULDBLOCK

Started by Leaguefun Nov 10, 2004 at 12:12 AM 4 replies 2.5k views
Original Post
Leaguefun
Leaguefun
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 ?
C-Junkie
C-Junkie
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?
Leaguefun
Leaguefun
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 ?
zackriggle
zackriggle
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) ).
Leaguefun
Leaguefun
Is TCP protocol may not be used for rapidly data transfer ? How to be done for commercial multi-player server ?

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.