Board index » delphi » INDY UDP Receive text Errors

INDY UDP Receive text Errors


2003-07-16 11:18:56 AM
delphi141
Hello,
I am sending and receiving text and records over an INDY UDP framework between a client and a server. i am initially sending a record with numbers and short strings by using SendBuffer and receive buffer which is wrking well. After each of these calls, i am using teh UDP server objects Send and Receivetext methods to pass a string of length that cannot be determined at design time.
At the moment this works fine for a period of time but after about an hour or so of working, the receivetext message starts reading weird characters which is throwing everything into disarray. The readbuffer / send buffer record has no problems. I was wondering if anyone has heard of this and may have a possible solution.
Many thanks for your help.
John W
 
 

Re:INDY UDP Receive text Errors

"John W" <XXXX@XXXXX.COM>writes
Quote

Hello,
I am sending and receiving text and records over an INDY UDP framework
between a client and a server. i am initially sending a record with numbers
and short strings by using SendBuffer and receive buffer which is wrking
well. After each of these calls, i am using teh UDP server objects Send and
Receivetext methods to pass a string of length that cannot be determined at
design time.
Note that the TidUDPserver does not have any receiveText method within
itself. There are receiveString and receiveBuffer methods inherited from
TidUDPbase *but* you must not use these! The UDP server uses a read thread
that calls the inherited methods to fire the onUDPread event. Calling the
IdUDPserver.receiveBlah methods will cause problems.
Use the onUDPread event to read your datagrams. Get the stream.size to find
out how big the datagram is & then use the stream methods to actually read
the datagram structure.
Rgds,
Martin