一,首先服务端开启监听
ServerSocket1->Port=StrToInt(5000);
ServerSocket1->Active=true;
ServerSocket1控件,响应ServerSocket1Listen事件;
二,创建连接
ClientSocket1->Address="127.0.0.1";
ClientSocket1->Port=StrToInt(5000);
ClientSocket1->Active=true;
ClientSocket1控件,首先响应ClientSocket1Lookup事件;
ClientSocket1控件,然后相应ClientSocket1Connecting事件;(如果连接服务器出错,则ClientSocket1Error事件处理)。
ClientSocket1控件,再响应ClientSocket1Connect事件;
ServerSocket1控件,响应ServerSocket1GetSocket事件;
ServerSocket1控件,响应ServerSocket1Acceptt事件;
ClientSocket1控件,再响应ClientSocket1Write事件;
三,客户端发送
ServerSocket1控件,响应ServerSocket1ClientRead事件;这个事件里服务向客户发送认证,由ClientSocket1Read事件接收。
四,事件说明:
ClientSocket1控件,ClientSocket1Read事件接收服务发回的信息。
ClientSocket1控件,再响应ClientSocket1Write事件;
BCB::TClientSocket,TServerSocket控件,布布扣,bubuko.com
BCB::TClientSocket,TServerSocket控件
原文地址:http://www.cnblogs.com/CPYER/p/3919622.html