做了两个端:服务器端、客户端
想在服务器端,把所有连接的客户端的一些信息显示出来,其中包括客户端的端口。代码:
  procedure TForm1.ServerClientConnect(Sender: TObject;
  Socket: TCustomWinSocket);
Var
  strIp,strHost:string;
  Count:Integer;
begin
  strIp:=Socket.RemoteAddress;
  strHost:=Socket.RemoteHost;
  M1.Lines.Add('SomeOne Login From');
  M1.Lines.add(#9'SocketID:'+Inttostr(Socket.SocketHandle));
  cbxID.Items.Add(Inttostr(Socket.SocketHandle));
  M1.lines.add(#9'IP:'+strIp);
  M1.Lines.Add(#9'Host:'+strHost);
  Count:=Server.Socket.ActiveConnections;
  S1.Panels.Items[1].Text:='OnLine user: '+IntToStr(Count);
end;