Re: Non-blocking method for reading writing objects to sockets
- From: Esmond Pitt <esmond.nospam.pitt@xxxxxxxxxxxxxxxxxx>
- Date: Sun, 08 May 2005 09:16:57 GMT
Joseph Dionne wrote:
One can read a socket non blocked, using a single method call, receiving either data, or no data.
or some data. There is a third state.
But, one cannot code a single method call to write non blocked in a "fire and forget" manner. Even you acknowledge that write might fail to emit all the data one attempted to write. So, one always needs to put a loop around socket write methods, terminating only after all data has been emitted.
or when you have something better to do in non-blocking mode than wait for the client to empty his receive buffer. Also, at some point you want to decide that this is never going to happen and you prefer to give up.
That is why is said "technically". Conceptually, a non blocked socket read method is expected to do one of two things, return data, or indicate that no data is returned, while a socket write can have three states, all data written, some data written, no data written. Since "some data written" will a application error. I'm pretty sure no one desires half of the STREAM delivered to the remote client.
Nevertheless that is how both the non-blocking read and non-blocking write calls behave on a socket. There are three states in both, and technically your statement does not hold water.
and BTW what exactly is a socket MCB? .
- Follow-Ups:
- Re: Non-blocking method for reading writing objects to sockets
- From: Joseph Dionne
- Re: Non-blocking method for reading writing objects to sockets
- References:
- Non-blocking method for reading writing objects to sockets
- From: Sameer
- Re: Non-blocking method for reading writing objects to sockets
- From: Joseph Dionne
- Re: Non-blocking method for reading writing objects to sockets
- From: Esmond Pitt
- Re: Non-blocking method for reading writing objects to sockets
- From: Joseph Dionne
- Non-blocking method for reading writing objects to sockets
- Prev by Date: Re: Do we have educational IDEs?
- Next by Date: web.xml help - struts
- Previous by thread: Re: Non-blocking method for reading writing objects to sockets
- Next by thread: Re: Non-blocking method for reading writing objects to sockets
- Index(es):
Relevant Pages
|