|
안녕하세요.
아직도 볼란드가 무척이나 무서운 왕 초보 기둥입니다.
Indy9을 이용하여 tcp로 server와 client를 연결하였습니다.
client에서 주기적으로 정수형 데이터를 sever로 보내려고 해서
기본 timer를 이용했습니다.
주기를 3000 ms로 하고
정수 10개를 보내는 코드를 작성하였는데,
연결된 이후에
첫 번째 주기에서 socket error가 발생합니다.
client code:
void __fastcall TForm2::Button1Click(TObject *Sender)
{
IdTCPClient1->Connect();
int i;
i=10;
IdTCPClient1->WriteInteger(i,true);
//---------------------------------------------------------------------------
void __fastcall TForm2::Timer1Timer(TObject *Sender)
{
int i;
if (IdTCPClient1->Connected()==true) {
for (i = 0; i <= 10; i++) {
IdTCPClient1->WriteInteger(i,true);
}
}
}
server code:
void __fastcall TForm2::IdTCPServer1Connect(TIdPeerThread *AThread)
{
int n;
n=AThread->Connection->ReadInteger();
Memo1->Lines->Add(n);
}
error code:
client 쪽:
First chance exception at $7C812A7B. Exception class EIdSocketError with message 'Socket Error # 10053
Software caused connection abort.'. Process Client_timer.exe (1456)
server 쪽:
First chance exception at $7C812A7B. Exception class EIdNoExecuteSpecified with message 'No execute handler found.'. Process Sever_timer.exe (1888)
여러 고수님의 많은 지도 기다리고 있습니다.
감사합니다.
|