Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- var
- s, c, c2, i: Integer;
- col: TMessArr;
- str: string;
- hosts: TStringArray;
- begin
- Writeln('Begin');
- s := CreateServerConnection(2022);
- if (s = -1) then
- begin
- Writeln('Failed to create the server connection');
- TerminateScript;
- end;
- c := OpenConnection('127.0.0.1', 2022, 9000);
- c2 := OpenConnection('127.0.0.1', 2022, 9000);
- SendConnectionData(c, 'Hello world!');
- SendConnectionData(c2, 'How are you?');
- col := ReadServerData(s);
- for i := 0 to High(col) do
- Writeln(col[i].host + ': ' + col[i].mess);
- if not SendServerData(s, 'localhost', 'I''m fine!') then
- begin
- Writeln('Failed to send data');
- TerminateScript;
- end;
- ReadConnectionData(c, str);
- Writeln(str);
- hosts := GetServerClients(s);
- for i := 0 to High(hosts) do
- Writeln(IntToStr(i) + ' -> ' + hosts[i]);
- FreeConnection(c);
- FreeConnection(c2);
- FreeServerConnection(s);
- Writeln('End');
- end.
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement