954,480 Members — Technology Publication meets Social Media
Username:
Password:
Lost login information?
Have something to say? Contribute New Article Reply to this Article

Winsock asynchronous sockets

Hi

During the last 6 months or so I've worked on and off on a couple of a classes to send data over network using winsock and asynchronous sockets on windows. Basically my system works like this.

The server will send packets on a connection until WSAGetLastError() returns WSAEWOULDBLOCK
the server then proceeds to queue the rest of the packets on the connection. When the connection gets an FD_WRITE message it continues to send data where it left off.

The problem I'm having is that sometimes the sending will stop because of WSAEWOULDBLOCK but no FD_WRITE message is sent afterwards. The test I'm using is kind of ridiculous, I'm sending 58800 packets in one burst but hey, it's not fun if you're not pushing the limits. When I'm testing I have both applications on the same computer I don't think it should make any difference but who knows.

I've heard people say that you shouldn't use asynchronous sockets for something serious because they're unreliable, but I've never found anything that specifies what's so bad about them and tbh this isn't something serious I just want to learn. But even if they are, they can't be this bad. If you want I can post some code but I'm not on that computer right now, I will be tomorrow.

I'm sorry for the poor English, I'm really tired.
Thanks
Kerp

kerp
Light Poster
30 posts since May 2010
Reputation Points: 9
Solved Threads: 5
 

Does your receive side code keep Receiving until it gets a WSAEWOULDBLOCK?
TCP is a stream protocol and doesn't deal in packets. There is no requirement for the stream to be delivered in the same number of packets as that transmitted. FD_WRITE should be issued again once the receiver feels able to receive more data.

gusmcn
Newbie Poster
2 posts since Apr 2010
Reputation Points: 10
Solved Threads: 0
 

This article has been dead for over three months

Post: Markdown Syntax: Formatting Help
You
View similar articles that have also been tagged: