求助~~关于TIdTCPClient和TIdTCPServer的问题
初学c++builder,用的是2010版
想写一段简单的两台电脑联通,可互发信息的小程序
请各位高人帮我看看下面这段程序有什么错 老是跳出Socket Error #10061
void_fastcall TForm1::IdTCPServer1Execute(TIdContext *AContext)
{
String str=AContext->Connection->IOHandler->ReadLn();
MessageBox(NULL,str.t_str(),"信息",MB_OK);
}
void_fastcall TForm1::Botton1Click(TObject *Sender)
{
if(IdTCPClient1->Connected()==false)
{
IdTCPClient1->Port=5050;
IdTCPClient1->Host="127.0.0.1";
IdTCPClient1->Connected();
}
IdTCPClient1->IOHandler->WriteLn(Edit->Text);
}
谢谢各位了,不胜感激~~
[解决办法]
IdTCPClient1->Connected();
改成:
IdTCPClient1->Connect();