求助大神们,谁有用TCP发出送字串的代码啊!
打算用网线连接发送字串过去,然后把返回的字串截取出来,现在请教大神们谁有连接的代码啊!
IP如图,端口4001,没其他要求了。新学的,底功很差,可以加我好友帮我啊!QQ:759971065 TCP/IP
[解决办法]
设置ClientSocket和ServerSocket的Active属性
[解决办法]
使用TCPClient,TcpClient->Host = Edit1->Text; TcpClient->Port = 4001;在'连接'->OnClicked事件里:
if(TcpClient->Connected){
if(TcpClient->RemontHost == Edit1->Text)return;
TcpClient->Disconnect();
TcpClient->RemontHost = Edit1->Text;
TcpClient->Connect();
};
if(TcpClient->Connected)
TcpClient->Disconnect();
if(TcpClient->Connected)在TcpClient->OnReceive事件中:
TcpClient->SendTo(...);
Edit2->Text = Buf;