procedure TForm1.Button1Click(Sender: TObject);
var sockets:array [1..1000] of TClientSocket;
i:integer;
begin
for i:=1 to 1000 do
begin
sockets[i]:=TClientSocket.Create;
sockets[i].OnConnect:=MyOnConnect;
end;
end;
procedure TForm1.MyOnConnect(Sender: TObject; Socket: TCustomWinSocket);
begin
//here you can decide which socket connected by the sender param,
//and use Socket to use the connection
end;