case FD_ACCEPT:
blabla = accept(..);
break;
case FD_READ:
blabla = recv( ... );
break;
case FD_WRITE:
// W0000000T !
break;
Thats right, i dont understand F*** on how the FD_WRITE event is generated ( and or used ).
So the question is how is it used ? Do i need to ativate it at all or can i just ignore it ? As to me it dont seem to have much use ... plz help !
Asynchronous Sockets problems
Okay i am writing a simple EVENT based application.
For the client i want to use Async sockets so i did some tutorials on the subject but there is still somthing that i dont quite get:
the FD_...... events.
August 24, 2003 04:12 PM
FD_WRITE is issued when it is clear to write to a socket.
A particular situations where this is important is when the last call to send() generated an WSAEWOULDBLOCK.
Depending on how you need things to work, you can simply stuff the sockets up to the available buffer size (causing the WSAEWOULDBLOCK to be retured), or you can send individual message packets, and wait for an FD_WRITE between each.
The first way is easier for most people to make work properly.
A particular situations where this is important is when the last call to send() generated an WSAEWOULDBLOCK.
Depending on how you need things to work, you can simply stuff the sockets up to the available buffer size (causing the WSAEWOULDBLOCK to be retured), or you can send individual message packets, and wait for an FD_WRITE between each.
The first way is easier for most people to make work properly.
Actually it might be useful if you're sending big files or really big amounts of data accross the network. When buffer space is available again, an FD_WRITE event will popup in the queue to tell the application it's now possible to send data again (NB: it will popup after the application is connected too).
But you're right, most of the time you don't really need it (AFAIK). (I wrote a complete working asynchronous server for a small-scale mmo without needing it at all).
[edited by - Cahaan on August 24, 2003 5:52:35 PM]
But you're right, most of the time you don't really need it (AFAIK). (I wrote a complete working asynchronous server for a small-scale mmo without needing it at all).
[edited by - Cahaan on August 24, 2003 5:52:35 PM]
Darkhaven Beta-test stage coming soon.
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement
Recommended Tutorials
Advertisement