Newsgroups : Borland : borland.public.delphi.internet.winsock : 2007 Sep : Re: TCPClient problems with ReadResponse
| Subject: | Re: TCPClient problems with ReadResponse |
| Posted by: | "I. Nemlich" (inemli..@gmail.com) |
| Date: | Thu, 27 Sep 2007 11:36:33 |
"Remy Lebeau (TeamB)" <no.spam@no.spam.com> wrote in message
news:46faa66c$1@newsgroups.borland.com...
>
> "Chris Conn" <Chris_Conn@ATADefense.com> wrote in message
> news:46fa9dea$1@newsgroups.borland.com...
>
>> On the other hand, when implementing the send record (which
>> works fine if i leave out the chat handling) the TReadResponse
>> 'hijacks' my data and causes errors.
>
> Which is exactly why you should not have more than one thread both reading
> or both writing to the same socket. At the very least, you should have a
> dedicated reading thread that receives all of the data and then passes
> each
> packet to the proper handler for parsing on a per-packet basis. Of
> course,
> this will only work if all of the packets have the same formatting, such
> as
> a fixed header on every packet so the receiver knows what kind of data it
> is
> and can forward it accordingly.
>
>> I have tried to suspend the rr thread then resume after my
>> RECORD handling is done.
>
> That is not reliable, especially if that thread is already in the middle
> of
> receiving data at the time you suspend it.
>
>> Any thoughts on how I can mix the 2 or a method that can handle my
> problem?
>
> You need to redesign your socket handling. Or else use multiple sockets.
>
>
> Gambit
none