Newsgroups : Borland : borland.public.delphi.internet.winsock : 2005 Jul : Connect Error

www.cryer.info
Managed Newsgroup Archive

Connect Error

Subject:Connect Error
Posted by:"Raym" (rmalo..@mbssoftware.com)
Date:Wed, 6 Jul 2005 07:29:26

The following  Procedure raises a 100048 (address in use) error when it is
called more than once.
A bare bones versions of the code is listed below.
The first time it is called it works fine... even when Getdata returns true
for several times.

But  on the next TimerTimer call  Connected  returns false and
TCPClient.Connect fails with a 100048 error.
If the Disconnect call is removed then the problem goes away.. But there
will be enough different users that keeping them all connected would not be
an option?

I am Using WIN XP SP2 on the Client and sending the data to  a  IdTCPServer
running on WIN Server 2003

It is written using  Delphi 7 with Sp and Indy 9.00.10

Any Idesa?

Procedure  TMainForm.TimerTimer;
var
  aDataSize : Integer;
aData : TData;
begin
  While GetData(AData) do
   begin
      If Not TCPClient.Connected then
        TCPClient.Connect;
     aDataSize := GetDataSize(aData);
     TCPClient.WriteInteger(ADataSize);
     TCPClient.WriteBuffer(AData ,Sizeof(TData));
      DeleteData(AData.Key);
   end;
   If  TCPClient.Connected then
        TCPClient.Disconnect;
end;

Replies:

www.cryer.info
Managed Newsgroup Archive