Newsgroups : Borland : borland.public.delphi.internet.winsock : 2007 Sep : Re: Converting From TClientSocket

www.cryer.info
Managed Newsgroup Archive

Re: Converting From TClientSocket

Subject:Re: Converting From TClientSocket
Posted by:"Jack Mason" (jackmas..@mindspring.com)
Date:Tue, 4 Sep 2007 12:19:23

Sorry, I did not mean to confuse things by reading 34 bytes.  I just
lifted some code from the working version using TClientSocket and
neglected to notice the byte count for the second read was always
decremented by one.

Here is actual working code with the Indy socket:

   Request := '12345677654321PASSWORDISTK2000139780618610037';
   Socket.Host := ': nashville.ingrambook.com';
   Socket.Port := 5501;
   Socket.Connect(5000);
   try
     Socket.Write(Request);
     sleep(2000);
     Response := Socket.ReadString(28);
     Byte_Count := StrToInt(Socket.ReadString(5));
     Response := Socket.ReadString(Byte_Count);
   finally
     Socket.Disconnect;
   end;

I haven't (to my knowledge) changed the read timeout value, but if I
remove the "sleep(2000)" the program gets an immediate "read timeout".
Perhaps I need to set the read timeout to be about 5 seconds?

Replies:

In response to:

www.cryer.info
Managed Newsgroup Archive