|
윤성민 님이 쓰신 글 :
: 제임스 님 그럼요 struct앞에다가 어떻게 operation_code를 붙이나요?
: struct mystruct{
: char operation_code;
: 어쩌구
: ..
: }
: 이렇게 하나요 아님
:
: strcat같은 것이 있나요?
: 죄송합니다. 정말 감사해요 ...ㅠㅠ
저같은 경우는 다음과 같이 처리합니다.
보낼경우는
operation 1에 해당하는 구조체로 전달할경우
class CPKT_OPERATION_1
{
u_char cOperationCode;
//나머지 전달해야될 값들....
struct A;
};
CPKT_OPERATION_1 sample_packet;
sample_packet.cOperationCode=0x01;
sample_packet.나머지 값들 채우기;
.......
m_ConnectSocket->SendBuf((char *)&sample_packet,sizeof(sample_packet));
받을 때는
void __fastcall TForm1::ReadEvent(....)
{
u_char operation_code;
Socket->ReceiveBuf((char *)&operation_code,1);
if (operation_code == 0x01)
{
struct a;
Socket->ReceiveBuf((char *)&a,sizeof(a));
//위에서 받은 내용이 구조체a에 들어가겠죵?
...........
//나머지 처리.
}
}
헥헥 힘드네엽...^^;
그럼 즐코딩되세엽
|