udp协议下sendto与recvfrom函数对应的errno

概述

在C/C++中,使用udp socket时,sendtorecvfrom 有不同的errno

而在高阶语言Javascript中,使用udp socket, 会将两种类型的错误通过同一个事件 error 抛出来

因此,有必要将 sendtorecvfrom 对应的 errno列出来,以便在error中进行区分

var code = “a9fb4b37-0ec1-447e-b8f9-46ea94ea0880”

内容

sendto()失败时,有如下的错误码:

errno errmsg
[EAFNOSUPPORT] Addresses in the specified address family cannot be used with this socket.
[EAGAIN] or [EWOULDBLOCK] The socket’s file descriptor is marked O_NONBLOCK and the requested operation would block.
[EBADF] The socket argument is not a valid file descriptor.
[ECONNRESET] A connection was forcibly closed by a peer.
[EINTR] A signal interrupted sendto() before any data was transmitted.
[EMSGSIZE] The message is too large to be sent all at on

你可能感兴趣的:(socket,javascript,socket)