Board index » delphi » Does Indy TCP/IP server return full strings or only partial? (using ReadLn)
John Klimek
![]() Delphi Developer |
John Klimek
![]() Delphi Developer |
Does Indy TCP/IP server return full strings or only partial? (using ReadLn)2006-02-24 04:26:18 AM delphi168 The title is a bit vague so let me be a little bit more descriptive... I'm using a game engine (Torque) as my client and it has built-in TCP/IP support. I am planning to use the Delphi 6 Indy components (TidTCPServer) and am wondering how to get these two things to interact with each other. What I am concerned about is reading/writing partial strings. So how does Indy receive data? Does it guarantee full strings to be returned? How can I view data byte-by-byte (for debugging)? Any other advice on how to code this properly so I don't lose any data over the network? Thanks. |
Remy Lebeau (TeamB)
![]() Delphi Developer |
2006-02-24 05:44:38 AM
Re:Does Indy TCP/IP server return full strings or only partial? (using ReadLn)
"John Klimek" <XXXX@XXXXX.COM>writes
QuoteSo how does Indy receive data? QuoteDoes it guarantee full strings to be returned? QuoteHow can I view data byte-by-byte (for debugging)? instance. Or you can write your own Intercept class for custom processing. Gambit |
John Klimek
![]() Delphi Developer |
2006-02-24 08:30:13 PM
Re:Does Indy TCP/IP server return full strings or only partial? (using ReadLn)
Thanks for the reply.
What is an intercept class? My protocol will be text-based (using some sort of *very* basic encryption) so I guess I need to look at TIdLog. Is there any more information on this? I have found TIdLogBase in the help files but thats it... (by the way, I am using Delphi 6 in case that matters) Thanks... "Remy Lebeau \(TeamB\)" <XXXX@XXXXX.COM>writes: Quote
|
John Klimek
![]() Delphi Developer |
2006-02-24 10:58:46 PM
Re:Does Indy TCP/IP server return full strings or only partial? (using ReadLn)
One more thing...
I put something like this inside of my TIdTCPServer's OnExecute event: log.write( AThread.Connection.Readln ); However, it seems like as soon as my client sends a character, it is immediately disconnected. Why is that? Also, how can I tell how many bytes are incoming? Thanks. "John Klimek" <XXXX@XXXXX.COM>writes: Quote
|
Remy Lebeau (TeamB)
![]() Delphi Developer |
2006-02-25 03:50:00 AM
Re:Does Indy TCP/IP server return full strings or only partial? (using ReadLn)
"John Klimek" <XXXX@XXXXX.COM>writes
QuoteHowever, it seems like as soon as my client sends a character, Gambit |
Remy Lebeau (TeamB)
![]() Delphi Developer |
2006-02-25 03:52:15 AM
Re:Does Indy TCP/IP server return full strings or only partial? (using ReadLn)
"John Klimek" <XXXX@XXXXX.COM>writes
QuoteWhat is an intercept class? data on the fly, such as for encryption and compression, and to log the data to files for later viewing and playback. Quoteby the way, I am using Delphi 6 in case that matters Gambit |
John Klimek
![]() Delphi Developer |
2006-02-25 11:04:20 PM
Re:Does Indy TCP/IP server return full strings or only partial? (using ReadLn)
I've gotten this fixed... (actually I forgot at the moment what I did yesterday to fix it).
However I have another question... Can I force Indy to send only ONE packet with my string data? For example, I want to this send this string to my client: MOVE 10 200 From what I remember, TCP can split that into two packets (for example, one containing "MOVE 1" and the next packet containing "0 200". I don't have much control over my client application so I would like to guarantee that only ONE packet gets sent with the full information... Is this possible? "Remy Lebeau \(TeamB\)" <XXXX@XXXXX.COM>writes: Quote
|
Remy Lebeau (TeamB)
![]() Delphi Developer |
2006-02-28 07:01:00 AM
Re:Does Indy TCP/IP server return full strings or only partial? (using ReadLn)
"John Klimek" <XXXX@XXXXX.COM>writes
QuoteCan I force Indy to send only ONE packet with my string data? QuoteFor example, I want to this send this string to my client: MOVE 10 200 QuoteFrom what I remember, TCP can split that into two packets then processing the full data. If you are using Indy on the other side, then all of that is handled transparently for you. QuoteI don't have much control over my client application integrity of the data. Quoteso I would like to guarantee that only ONE packet gets sent with the libc under Linux, etc) that directly communicates with the hardware. There is nothing the socket library that sits on top of the socket stack (Indy in this case) can do about that. The stack accepts as much data as it can into its internal buffer, returning to the caller how many bytes were accepted, and then the stack sends that buffer over the network in the background at its leisure. Gambit |