在C/C++中,使用udp socket时,sendto 与 recvfrom 有不同的errno
而在高阶语言Javascript中,使用udp socket, 会将两种类型的错误通过同一个事件 error 抛出来
因此,有必要将 sendto 与 recvfrom 对应的 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 once, as |