[twsocket] OnDataAvailable call twice

Azrin Aris zigasoft@tm.net.my
Mon, 05 Jun 2000 09:50:45 +0800


Yes, I'm aware of that. I've use your second method that is to send a small
header block and then check the amount of bytes received. When the supposed to
received bytes is received, I set the state (my own boolean flag) from
receivingstream=true to receivingstream=false. I can send you the code if you
are willing to inspect it for me. I would appreciate it grately.

Cheers,
Azrin

Stephen Williams wrote:

> You should never expect the OnDataAvailable event to be triggered the same
> number of times as you call the Send method on the sender side.  TCP will
> break up the data into different size packets as it sees fit.
>
> The task of your receiving application is to piece the sections back
> together again into their original form.  This is why your protocol must
> include some information to assist this process.  This can take the form of
> a terminating sequence of characters (usually #13#10 for text-based
> protocols) or a small header block preceding the data that informs the
> receiving end of the amount of data it should expect to receive.
>
> Steve 'Sly' Williams
> IT Development
> Cable & Wireless Optus Outsourcing Services
> swilliams@fm.optus.net.au
> ------------------------------------------------------------
> (On going to war over religion:) "You're basically killing each other to see
> who's got the better imaginary friend."
> ------------------------------------------------------------
>
> > Hi, I've written an application (client & server) that sends and
> > receives large stream with ICS. My problem is in the client app., the
> > OnDataAvailable is call twice. I've checked by placing a brake at the
> > transmitting server, it only sent the stream once. I know
> > there must be
> > something wrong with my code but I connot find them. Anybody had had
> > this problem before and found a way to solve it?. Any help
> > would be very
> > much appreciated.
>
> _______________________________________________
> TWSocket mailing list [http://elists.org/mailman/listinfo/twsocket]
> Visit our website at http://www.rtfm.be/fpiette/indexuk.htm