Board index » delphi » TTCP Annoyances

TTCP Annoyances

Hi folks,

I wonder if anyone can help me with this annoyance, please?

In Delphi 3, I am writing a simple network server that has a socket
listening for incoming TCP connections.  When the socket receives a
connection request, a 'session' object is created to handle the connection,
and the requestID is passed to it.

The session object creates a new TTCP and Accepts the connection, and the
connection goes through.  Some text is transmitted back to the remote
client, and this works fine.  However, the problem is that I can't seem to
set the newly created socket's OnDataArrival property.  Delphi doesn't
complain about anything, there are no syntax errors, I just don't get any
notifications.

Here are a few relevant snipped-around bits of code:

procedure TfrmMain.tcpConnectionRequest
    NewSession := TSession.Create(Self);
    NewSession.Init (requestID,ConnectNo);

---------

type TSession = class (TComponent)
  private
    tcpSocket: TTCP;
    procedure TcpRx (Sender: TObject; bytesTotal: Integer);

procedure TSession.Init (requestID: Integer);
  tcpSocket := TTCP.Create(Self);
  with tcpSocket do begin
    OnDataArrival := Self.TcpRx;
    Accept (requestID);
  end;

procedure TSession.TcpRx (Sender: TObject; bytesTotal: Integer);
begin
  ShowMessage ('Hooray I actually got some data back');
end;

Any thoughts on this, please?  Any help would really be appreciated :o)

Cheers,

Philip.

 

Re:TTCP Annoyances


Quote
>I wonder if anyone can help me with this annoyance, please?

>In Delphi 3, I am writing a simple network server that has a socket
>listening for incoming TCP connections.  When the socket receives a
>connection request, a 'session' object is created to handle the connection,
>and the requestID is passed to it.

You should probably use ICs (Internet Component Suite). It is freeware,
include full sorce code, very easy to use. Free support available using a
mailing list. Download source code (ICS.ZIP) from
http://www.rtfm.be/fpiette/indexuk.htm

--
francois.pie...@pophost.eunet.be
The freeware Internet Component Suite maker
The freeware MidWare middleware maker
Download from http://www.rtfm.be/fpiette/indexuk.htm

Other Threads