Newsgroups : Borland : borland.public.delphi.internet.winsock : 2007 May : 'Could not bind socket. Address and port are already in use

www.cryer.info
Managed Newsgroup Archive

'Could not bind socket. Address and port are already in use

Subject:'Could not bind socket. Address and port are already in use
Posted by:"Ernest P. Woorell" (lkill..@charter.net)
Date:Mon, 21 May 2007 12:54:32

I have been working with this all morning.  I have two clients on a test
form.  I open each by it's own button.  Most of the time I get the following
"Project SenderPrj.exe raised exception class EIdCouldNotBindSocket with
message 'Could not bind socket.  Address and port are already in use.'. "

Sometimes I am able to open one of them but usually not.

Now here is the wierd part.  After investigating the server, testing to
assure no other device is using the same port, I finally diconnected the
network cable from the server. I still get the same error!!  Just to make
sure, I ping those ports after teh cable is disconnected and receive no
return.

How can the port be in use when the network cable is disconnected??

Thanks


procedure TForm1.btnConn6Click(Sender: TObject);
begin
  try
    IdTCPClient1.Connect;
  except
    on e: exception do SHowMessage(e.Message+' Send 6');
  end;

end;

procedure TForm1.btnConn7Click(Sender: TObject);
begin
  try
    IdTCPClient2.Connect;
  except
    on e: exception do SHowMessage(e.Message +' Send 7');
  end;
end;


  object IdTCPClient1: TIdTCPClient
    OnDisconnected = IdTCPClient1Disconnected
    BoundIP = '192.168.100.13'
    BoundPort = 23
    ConnectTimeout = 0
    Host = '192.168.100.13'
    IPVersion = Id_IPv4
    OnConnected = IdTCPClient1Connected
    Port = 23
    ReadTimeout = -1
    OnBeforeBind = IdTCPClient1BeforeBind
    Left = 168
    Top = 152
  end
  object IdTCPClient2: TIdTCPClient
    OnDisconnected = IdTCPClient2Disconnected
    BoundIP = '192.168.100.55'
    BoundPort = 23
    ConnectTimeout = 0
    Host = '192.168.100.55'
    IPVersion = Id_IPv4
    OnConnected = IdTCPClient2Connected
    Port = 23
    ReadTimeout = -1
    OnBeforeBind = IdTCPClient2BeforeBind
    Left = 288
    Top = 152
  end

Replies:

www.cryer.info
Managed Newsgroup Archive