mysticbbs/mdl/mdltest3.pas

61 lines
1.7 KiB
ObjectPascal
Raw Permalink Normal View History

// ====================================================================
// Mystic BBS Software Copyright 1997-2013 By James Coyle
// ====================================================================
//
// This file is part of Mystic BBS.
//
// Mystic BBS is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// Mystic BBS is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with Mystic BBS. If not, see <http://www.gnu.org/licenses/>.
//
// ====================================================================
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.