recv 나 send같은 함수들에 대한 리턴값 들은..
중간에 오류가 있을경우 어떤 오류인지 오류번호를 리턴해주거든요..
자세한건 man페이지를 참고하세요..
ERRORS
These are some standard errors generated by the socket layer. Addi-
tional errors may be generated and returned from the underlying proto-
col modules; see their manual pages.
EBADF The argument s is an invalid descriptor.
ECONNREFUSED
A remote host refused to allow the network connection (typically
because it is not running the requested service).
ENOTCONN
The socket is associated with a connection-oriented protocol and
has not been connected (see connect(2) and accept(2)).
ENOTSOCK
The argument s does not refer to a socket.
EAGAIN The socket is marked non-blocking and the receive operation
would block, or a receive timeout had been set and the timeout
expired before data was received.
EINTR The receive was interrupted by delivery of a signal before any
data were available.
EFAULT The receive buffer pointer(s) point outside the process's
address space.
EINVAL Invalid argument passed.
ENOMEM Could not allocate memory for recvmsg.
recv 나 send같은 함수들에 대한 리턴값 들은..중간에 오류가
recv 나 send같은 함수들에 대한 리턴값 들은..
중간에 오류가 있을경우 어떤 오류인지 오류번호를 리턴해주거든요..
자세한건 man페이지를 참고하세요..
ERRORS These are some standard errors generated by the socket layer. Addi- tional errors may be generated and returned from the underlying proto- col modules; see their manual pages. EBADF The argument s is an invalid descriptor. ECONNREFUSED A remote host refused to allow the network connection (typically because it is not running the requested service). ENOTCONN The socket is associated with a connection-oriented protocol and has not been connected (see connect(2) and accept(2)). ENOTSOCK The argument s does not refer to a socket. EAGAIN The socket is marked non-blocking and the receive operation would block, or a receive timeout had been set and the timeout expired before data was received. EINTR The receive was interrupted by delivery of a signal before any data were available. EFAULT The receive buffer pointer(s) point outside the process's address space. EINVAL Invalid argument passed. ENOMEM Could not allocate memory for recvmsg.이게 recv의 man페이지에 있는
에러유형에 대한 설명입니다..
저렇게 define된 값을 사용하려면
errno.h 를 include시키면 되겠죠
오랫동안 꿈을 그리는 사람은 그 꿈을 닮아간다...
http://mytears.org ~(~_~)~
나 한줄기 바람처럼..
[code:1]if (에러){
if (에러) { printf("msg = %s\n", strerror(errno)); }위처럼 하시면 됩니다. 필요한 헤더파일은 errno.h, string.h 입니다.
The Future !!!
꼭 Send/Recv가 아니어도 에러를 판별하고 싶다면..gets
꼭 Send/Recv가 아니어도 에러를 판별하고 싶다면..
getsockopt를 가지고 errno를 읽어올 수 있습니다.
가끔은 밥을 굶어도 살 수 있다.
댓글 달기