[EMAIL PROTECTED] wrote:

Do you mean that you could have pieces of multiple transmissions in the same DataAvailable event? How would you tell them apart?


You will still get the data in the same sequence that you wrote it, but you may have more than one seperator available in the datavailable event.

So let's say you do:

socket.write("Hello") + seperator
socket.write("World") + seperator
socket.write("It's me!) + seperator

You might get:

Hello + seperator + World + seperator + It's

and then in the next fire of the event you might get:

me! + seperator

So you need to loop through the available data and look for seperators. For each seperator you find, you have the end of one message. If you get an incomplete message, you can choose to leave it in the buffer until the next fire. It may look something like this:

 i = instr(me.lookahead,seperator)
 while i > 0
   if i > 0 then
     s = me.read(i)
     //s now has a complete message + seperator
   end if
   i = instr(me.lookahead,seperator)
 wend

hth,

Brian
_______________________________________________
Unsubscribe or switch delivery mode:
<http://www.realsoftware.com/support/listmanager/>

Search the archives of this list here:
<http://support.realsoftware.com/listarchives/lists.html>

Reply via email to