IdTCPServer1
Server本身就支持多线程,一个服务端连接多个客户端。
IdTCPServer1.Bindings.Add.IP := '127.0.0.1';
IdTCPServer1.Bindings.Add.Port := 153;
void __fastcall TForm2::IdTCPServer1Execute( TIdContext * AContext )
{
AContext->Binding->PeerIP;
AContext->Binding->PeerPort; AContext->Connection->IOHandler->SendBufferSize;
AContext->Connection->IOHandler->Write( );
AContext->Connection->IOHandler->WriteFile( );
AContext->Connection->IOHandler->WriteDirect( );
AContext->Connection->IOHandler->WriteLn( ); AContext->Connection->IOHandler->Readable( );
AContext->Connection->IOHandler->ReadByte( );
AContext->Connection->IOHandler->ReadBytes( );
AContext->Connection->IOHandler->ReadChar( );
AContext->Connection->IOHandler->ReadStream( );
AContext->Connection->IOHandler->ReadString( );
AContext->Connection->IOHandler->ReadStrings( );
AContext->Connection->IOHandler->ReadInt16( );
}