글쓴이: 익명 사용자 / 작성시간: 월, 2002/06/24 - 2:32오후
안녕하세요. .
소켓 이용해서 데이터 read하는데여..
int k, client_sock;
char dBuff[4096];
k = read(client_socket, dBuff, sizeof(dBuff));
이렇게 했거든요.. 근데... k값을 찍어보면 1046 정도로 나옵니다.
혹시 이런경우 있으신분.. 있나요?/
해결하셨다면.... 문제점 지적해 주세요..
좋은하루 되시구여 한국축구 화이팅 입니다~~ ^^
Re: socket으로 read할때..
넵 당근 그렇게 나옵니다. 심한경우는 84byte 인가 이렇게 받을때두 많습
니다.
이건 잘못된것이 아니라 다음 Packet 이 계속 오는 중이므로 Data 가 다
올때까지 계속 읽어줘야 합니다.
즉, 끊어서 읽기를 해야 한다는 말이 되겠죠....
즐프...
Re: socket으로 read할때..
k = read(client_socket, dBuff, sizeof(dBuff));
read함수대신에 recv함수를 이용해보세요.
k = recv(client_socket, dBuff, sizeof(dBuff), MSG_WAITALL);
MSG_WAITALL
This flag requests that the operation block until
the full request is satisfied. However, the call
may still return less data than requested if a sig?
nal is caught, an error or disconnect occurs, or
the next data to be received is of a different type
than that returned
댓글 달기