|
김준원 님이 쓰신 글 :
: 송신부분에서 송신을 SendBuffer로 하는듯 한데요
: SendBuffer의 SendData가 어떻게 되는거죠???? SendData에 무슨 값을 넣어줘야 되는듯한데 그 부분도 설명 부탁드립니다.
:
: 금목암 님이 쓰신 글 :
: : 송신방법
: : // IdUDPClient1->SendBuffer(SendData,12); // ok 클라이언트
: :
: : 수신방법
: : void __fastcall TForm1::IdUDPServer1UDPRead(TObject *Sender,
: : TStream *AData, TIdSocketHandle *ABinding)
: : {
: : // udp 통신 수신시 처리 방법
: : AnsiString str1;
: : String str;
: : char *dda;
: : char ddb[5];
: : TStringStream* pss = new TStringStream(str1);
: : pss->CopyFrom(AData, AData->Size);
: : pss->Seek(0, soFromBeginning);
: : str1 =pss->DataString;
: : delete pss;
: :
// char SendData[10];
// String send1;
// int send_len;
send1="#ME001^";
/*
SendData[0]='S';
SendData[1]='0';
SendData[2]='1';
SendData[3]='M';
SendData[4]='B';
SendData[5]='0';
SendData[6]='0';
SendData[7]='0';
SendData[8]='1';
SendData[9]='2';
SendData[10]='3';
SendData[11]='X';
SendData[12]=0x00;
str2=Edit3->Text;
str2="abcd";
이런식으로 넣으시면 됩니다
if(IdUDPClient1->Active==false)
{
ShowMessage ("포트가 닫혀있습니다 ");
return; // 포트가 열려있는지 체크하여 닫혀있으면 안보낸다
}
char SendData[10];
strcpy(SendData,send1.c_str());
send_len=send1.Length();
IdUDPClient1->SendBuffer(SendData,send_len); // ok 클라이언트
이런식으로 보내셔도 되고 이 정도는 아시겠죠 인디가 c빌더에게 너무 푸대접이고 델파이만
좋아하는지 예제도 거의다 델파이로 된게 많네요
|