Newsgroups : Borland : borland.public.delphi.internet.winsock : 2007 Apr : Help with Indy + TIdTCPClient + sending/receiving non-terminated text
| Subject: | Help with Indy + TIdTCPClient + sending/receiving non-terminated text |
| Posted by: | "ArbiterX" (samra13..@yahoo.com) |
| Date: | Tue, 24 Apr 2007 20:35:21 |
Hi,
I am a new delphi user, and have just started with socket programming. I
have a problem, that I can not quite understand.
I would like to know a convenient method to send a text string in unaltered
form to a server(this is not a delphi server), and then receiving the
servers reply which is in the same format, a non terminated text string. The
textstring might have carriage return and newline in the middle of the text,
so I want to take care of the entire message.
Here is a code-snapshot from the client:
Client.Connect;
try
Client.Socket.Write(testString);
// Here, I am supposed to receive the reply from the server.
finally
Client.Disconnect;
end;
end;
I am sending the string correctly? And how can I receive the textstring from
the server afterwards? I have tried the read methods from socket class, but
they lock up, as in they seem to be polling there forever.
The server is an HTTP server, does that mean that I have to contact it with
HTTP protocol? Or can I contact it by sending this textstring which has an
xml protocol imbedded. I am supposed to send an xml message, which is base64
encoded.
Btw, I do not know the size of the stringe before hand that I receive, can
this cause a problem? Should I use stream instead? The strings are quite
small, less than 1KB.
Debugging is hard for me, as I do not have any other access to the server
side.
Thanks in advance, I appreciate your help.