mysticbbs/mdl/mdltest3.pas

41 lines
746 B
ObjectPascal
Raw Normal View History

2012-02-13 15:48:58 -08:00
Program Test3;
{$I m_ops.pas}
Uses
2013-05-11 20:19:36 -07:00
m_io_Sockets;
2012-02-13 15:48:58 -08:00
Var
2013-05-11 20:19:36 -07:00
Server : TIOSocket;
Client : TIOSocket;
2012-02-13 15:48:58 -08:00
Str : String;
Begin
2013-05-11 20:19:36 -07:00
Server := TIOSocket.Create;
2012-02-13 15:48:58 -08:00
2013-05-11 20:19:36 -07:00
Server.WaitInit('0.0.0.0', 23);
2012-02-13 15:48:58 -08:00
WriteLn('Waiting on port 23 for TEST4 client example...');
2013-05-11 20:19:36 -07:00
Client := Server.WaitConnection(5000);
2012-02-13 15:48:58 -08:00
If Client = NIL Then Begin
WriteLn ('An error has occured; no client detected');
Server.Free;
Halt;
End;
WriteLn;
WriteLn ('Got connection from:');
WriteLn (' Host: ', Client.FPeerName);
WriteLn (' IP: ', Client.FPeerIP);
WriteLn;
Client.WriteLine('Welcome to the MDL test server!');
Client.ReadLine(Str);
WriteLn('Received: ', Str);
Server.Free;
Client.Free;
End.