在server端的ServerSocket1ClientRead事件里判断,就可以了。
var
s:string;
id: integer;
socket1: TCustomWinSocket;
begin
leng := socket.ReceiveLength;
s := copy(socket.ReceiveText, 1, leng);
if s='1' then
id := strtoint(socket.remoteaddress));
socket1 := TCustomWinSocket.Create(id);
socket1.sendtext('15');
if s='2' then
....
end;