5 51zhan.com Unregistered / Unconfirmed GUEST, unregistred user! 2007-04-05 #1 ServerSocket1,ClientSocket1,如何获取与ServerSocket1连接的所有ClientSocket1的IP地址? ( 积分: 18 )<br />如题
D dangde Unregistered / Unconfirmed GUEST, unregistred user! 2007-04-06 #2 很简单的吧, 按照连接数一个个的索引啊, ServerSocket有一个属性的。你看看。
W wzquan Unregistered / Unconfirmed GUEST, unregistred user! 2007-04-06 #3 clientsocket连接上serversocket,在serversocket中就能反映出client的IP地址,只需要读一下就可以了 procedure TServerClientForm.ServerSocket1ClientConnect(Sender: TObject; Socket: TCustomWinSocket); Var myStrIP:String; begin myStrIP:=socket.RemoteAddress; ListBox1.Items.Add(myStrIP); end;
clientsocket连接上serversocket,在serversocket中就能反映出client的IP地址,只需要读一下就可以了 procedure TServerClientForm.ServerSocket1ClientConnect(Sender: TObject; Socket: TCustomWinSocket); Var myStrIP:String; begin myStrIP:=socket.RemoteAddress; ListBox1.Items.Add(myStrIP); end;
S skadon Unregistered / Unconfirmed GUEST, unregistred user! 2007-04-06 #4 for i:=0 to ServerSocket2.Socket.ActiveConnections-1 do Memo1.Lines.Add(ServerSocket2.Socket.Connections.RemoteAddress + ' '+ inttostr(ServerSocket2.Socket.Connections.RemotePort));
for i:=0 to ServerSocket2.Socket.ActiveConnections-1 do Memo1.Lines.Add(ServerSocket2.Socket.Connections.RemoteAddress + ' '+ inttostr(ServerSocket2.Socket.Connections.RemotePort));