When I send a string from my test utility, the ClientConnect() event(*)
fires in my app, which is listening for messages, but the
ClientDataAvailable() event(**) is not fired. 

 

And when I send the message a second time from the test utility, I get
"Connect: socket already in use".

 

Also, the sending utility freezes up after sending the message.

 

{ Taken from the ICS demo }

procedure TfClientMain.WSocketServerClientConnect(Sender: TObject; Client:
TWSocketClient; Error: Word);

begin

  with Client as TTcpSrvClient do begin

    ShowMessage('Client connected.' +

            ' Remote: ' + PeerAddr + '/' + PeerPort +

            ' Local: '  + GetXAddr + '/' + GetXPort);

    ShowMessage('There is now ' +

            IntToStr(TWSocketServer(Sender).ClientCount) +

            ' client(s) connected.');

    LineMode            := TRUE;

    LineEdit            := TRUE;

    LineLimit           := 255; { Do not accept long lines } //changed from
255

    OnDataAvailable     := ClientDataAvailable;

    OnLineLimitExceeded := ClientLineLimitExceeded;

    OnBgException       := ClientBgException;

    ConnectTime         := Now;

  end;

end;

 

{ Taken from the ICS demo, too -- this event never gets fired }

procedure TfClientMain.ClientDataAvailable(Sender: TObject; Error: Word);

begin

  with Sender as TTcpSrvClient do begin

    { We use line mode. We will receive complete lines }

    RcvdLine := ReceiveStr;

    { Remove trailing CR/LF }

    while (Length(RcvdLine) > 0) and

          (RcvdLine[Length(RcvdLine)] in [#13, #10]) do

      RcvdLine := Copy(RcvdLine, 1, Length(RcvdLine) - 1);

    ShowMessage('Received from ' + GetPeerAddr + ': ''' + RcvdLine + '''');

    //ProcessData(Sender as TTcpSrvClient);

  end;

end;

 

I must be missing something yet...

The information transmitted is intended only for the person or entity to
which it is addressed and may contain confidential and/or privileged
material.  If the reader of this message is not the intended recipient,
you are hereby notified that your access is unauthorized, and any review,
dissemination, distribution or copying of this message including any
attachments is strictly prohibited.   If you are not the intended
recipient, please contact the sender and delete the material from any
computer.
-- 
To unsubscribe or change your settings for TWSocket mailing list
please goto http://www.elists.org/mailman/listinfo/twsocket
Visit our website at http://www.overbyte.be

Reply via email to