Newsgroups : Borland : borland.public.delphi.internet.winsock : 2006 Apr : TServerSocket.OnClientConnect is not executing.... why?

www.cryer.info
Managed Newsgroup Archive

TServerSocket.OnClientConnect is not executing.... why?

Subject:TServerSocket.OnClientConnect is not executing.... why?
Posted by:"John Klimek" (jklim..@gmail.com)
Date:28 Apr 2006 10:00:53

Here is a brief overview of my code:

[main.pas]  (console application
  TGameServer := TGameServer.Create;
  TGameServer.InitServer();

  // Infinite loop (eg. just have GameServer object accept/process connections)
  while (true) do
  begin
    sleep(100);
  end;

[gameserver.pas]
  procedure TGameServer.InitServer();
  begin
    _serverSocket := TServerSocket.Create(nil);
    _serverSocket.Port := 4040;
    _serverSocket.ServerType := stNonBlocking;
    _serverSocket.OnClientConnect := SocketOnConnect;
  end;

  procedure TGameServer.SocketOnConnect(Sender: TObject; Socket: TCustomWinSocket);
  begin
    ShowMessage('Client connected!'); // NEVER GETS EXECUTED
  end;


Why does my OnClientConnect never get executed?  The other actions (eg. OnClientDisconnect, OnClientAccept) also never get executed.

What am I doing wrong?  This is a simple console application with two files (well, there are more but they are not relevant)

Replies:

www.cryer.info
Managed Newsgroup Archive