Newsgroups : Borland : borland.public.delphi.internet.winsock : 2006 Dec : Linger. TClientSocket. Server kicks me! :(

www.cryer.info
Managed Newsgroup Archive

Linger. TClientSocket. Server kicks me! :(

Subject:Linger. TClientSocket. Server kicks me! :(
Posted by:"jordillussa" (jordillus..@yahoo.com)
Date:22 Dec 2006 02:02:02

Hello I'm developing an application that connects using a TClientSocket
(WINDOWS) to an external server (LINUX). The problem is that when I
send a message to the server  using my TClientSocket, the server
answers me with a message and inmediately he closes the connection...
the result is that I "catch" an error receive in a try except
structure.  Here are communications log:

22/12/06 10:28:56:796 Connect: Local: dp11(172.30.14.106):4037,
Remote:???(10.46.254.1):7000, Handle: 1568

22/12/06 10:28:56:812 Write: 9906122210289999999000041793788


                                                                     :
Local: dp11(172.30.14.106):4037, Remote:???(10.46.254.1):7000, Handle:
1568

22/12/06 10:28:57:265 Read: OK
12/22/200610:28:57


                                               [0B]: Local:
dp11(0.0.0.0):4037, Remote:???(10.46.254.1):7000, Handle: 1568

22/12/06 10:28:57:265 Error (eeReceive) 10054  Local:
dp11(0.0.0.0):4037, Remote:???(10.46.254.1):7000, Handle: 1568

22/12/06 10:28:57:265 Error (eeDisconnect) 10053  Remote:
(10.46.254.1):7000


What should I do to avoid this "receive" error? I think the linger
options is not useful for me because it's the server who closes the
connection and I have no access to the source code of the server
because it's not mine. Only the client is my software.

My code is like this;

constructor TCGE_ClientSocketProtocolGISAE.Create(AOwner: TComponent);
var
  ls: linger;
begin
  inherited Create(AOwner);
  FSocket := TClientSocket.Create(Self);

  with FSocket do
  begin
    ClientType   := ctNonBlocking;
    OnConnect    := Connect;
    OnDisconnect := Disconnect;
    OnError      := Error;
    OnRead       := Read;
  end;

  ls.l_onoff  := 1;
  ls.l_linger := 1;
  setsockopt(FSocket.Socket.Handle, SOL_SOCKET, SO_LINGER, @ls, 4);
end;


Thank you very much. Jordi.

Replies:

www.cryer.info
Managed Newsgroup Archive