赞
踩
错误号 | 错误 | 可能的原因 |
EAGAIN | Try again | 在读数据的时候,没有数据在底层缓冲的时候会遇到,一般的处理是循环进行读操作,异步模式还会等待读事件的发生再读 |
EWOULDBLOCK | Operation would block | 在我们的环境中和EAGAIN是一个值, 一般情况下只关心EAGAIN就可以了 |
EPIPE | Broken pipe | 接收端关闭(缓冲中没有多余的数据),但是发送端还在write. |
ECONNRESET | Connection reset by peer | 收 到RST包 可能是 接收到数据后不进行读取或者没有读取完毕直接close,另一端再调用write或者read操作,这个时候需要检查一下是否存在脏数据或者一端某些情况 下断开的情况. 另外 使用了SO_LINGER后close连接,另一端也会收到这个错误. 另外在epoll中一般也是可能返回EPOLLHUP事件。 连接的时候也可能出现这样的错误,这个参考后面的 "listen的时候的backlog有什么影响 "中的说明 |
EINTR | Interrupted system call | 被其他的系统调用中断了, 对于句柄进行操作比较容易出现,一般裸用recv都是需要判断的, 处理也很简单, 再进行一次操作就可以了 |
ETIMEDOUT | Connection timed out | 连接超时, 但是在我们ul_sread_xxx或者ul_swrite_xx系列中也被我们用来表示读写超时 |
ECONNREFUSED | Connection refused | 拒绝连接, 一般在机器存在但是相应的端口上没有数据的时候出现 |
ENETUNREACH | Network is unreachable | 网络不可达,可能是由于路器的限制不能访问,需要检查网络 |
EADDRNOTAVAIL | Cannot assign requested address | 不能分配本地地址,一般在端口不够用的时候会出现,很可能是短连接的TIME_WAIT问题造成 |
EADDRINUSE | Address already in use | 地址已经被使用, 已经有相应的服务程序占用了这个端口, 或者占用端口的程序退出了但没有设置端口复用 |
ENOTCONN | Transport endpoint is not connected | 连接没有链上。 在一个socket出来还没有accept或者connenct, 还有一种情况就是收到对方发送过来的RST包,系统已经确认连接被断 |
对一些常见错误号的分析
Linux Socket Errno错误代码列表
124EMEDIUMTYPE Wrong medium type
123 ENOMEDIUM No medium found
122EDQUOT Disk quota exceeded
121 EREMOTEIO Remote I/O error
120EISNAM Is a named type file
119ENAVAIL No XENIX semaphores available
118ENOTNAM Not a XENIX named type file
117EUCLEAN Structure needs cleaning
116ESTALE Stale NFS file handle
115 EINPROGRESS +Operation nowin progress
114EALREADY Operation already in progress
113 EHOSTUNREACH No route tohost
112 EHOSTDOWN Host is down
111 ECONNREFUSED Connection refused
110 ETIMEDOUT +Connection timed out
109 ETOOMANYREFS Too manyreferences: cannot splice
108 ESHUTDOWN Cannot send after transport endpoint shutdown
107ENOTCONN Transport endpoint is not connected
106EISCONN Transport endpoint is alreadyconnected
105ENOBUFS No buffer space available
104 ECONNRESET Connection reset by peer
103 ECONNABORTED Softwarecaused connection abort
102 ENETRESET Network dropped connection on reset
101 ENETUNREACH Networkis unreachable
100ENETDOWN Network is down
99 EADDRNOTAVAIL Cannot assignrequested address
98 EADDRINUSE Address already in use
97 EAFNOSUPPORT Addressfamily not supported by protocol
96 EPFNOSUPPORT Protocolfamily not supported
95 EOPNOTSUPP Operation not supported
94 ESOCKTNOSUPPORT Socket typenot supported
93 EPROTONOSUPPORT Protocol notsupported
92 ENOPROTOOPT Protocol not available
91 EPROTOTYPE Protocol wrong type for socket
90EMSGSIZE +Message too long
89 EDESTADDRREQ Destination address required
88ENOTSOCK Socket operation on non-socket
87EUSERS Too many users
86ESTRPIPE Streams pipe error
85 ERESTART Interrupted system call should be restarted
84EILSEQ Invalid or incompletemultibyte or wide character
83ELIBEXEC Cannot exec a shared library directly
82ELIBMAX Attempting to link in too manyshared libraries
81 ELIBSCN .lib section in a.out corrupted
80ELIBBAD Accessing a corrupted shared library
79ELIBACC Can not access a needed sharedlibrary
78EREMCHG Remote address changed
77EBADFD File descriptor in bad state
76ENOTUNIQ Name not unique on network
75EOVERFLOW Value too large for defined data type
74EBADMSG +Bad message
73EDOTDOT RFS specific error
72EMULTIHOP Multihop attempted
71EPROTO Protocol error
70ECOMM Communication error onsend
69ESRMNT Srmount error
68EADV Advertise error
67ENOLINK Link has been severed
66EREMOTE Object is remote
65ENOPKG Package not installed
64ENONET Machine is not on the network
63ENOSR Out of streams resources
62ETIME Timer expired
61ENODATA No data available
60ENOSTR Device not a stream
59EBFONT Bad font file format
57EBADSLT Invalid slot
56EBADRQC Invalid request code
55ENOANO No anode
54EXFULL Exchange full
53EBADR Invalid request descriptor
52EBADE Invalid exchange
51EL2HLT Level 2 halted
50ENOCSI No CSI structure available
49EUNATCH Protocol driver not attached
48ELNRNG Link number out of range
47EL3RST Level 3 reset
46EL3HLT Level 3 halted
45EL2NSYNC Level 2 not synchronized
44ECHRNG Channel number out of range
43EIDRM Identifier removed
42ENOMSG No message of desired type
40ELOOP Too many levels ofsymbolic links
39 ENOTEMPTY +Directory not empty
38 ENOSYS +Function not implemented
37ENOLCK +No locks available
36 ENAMETOOLONG +File name toolong
35EDEADLK +Resource deadlock avoided
34ERANGE +Numerical result out of range
33EDOM +Numerical argument out ofdomain
32EPIPE +Broken pipe
31EMLINK +Too many links
30EROFS +Read-only file system
29ESPIPE +Illegal seek
28ENOSPC +No space left on device
27EFBIG +File too large
26ETXTBSY Text file busy
25ENOTTY +Inappropriate ioctl for device
24EMFILE +Too many open files
23ENFILE +Too many open files in system
22EINVAL +Invalid argument
21EISDIR +Is a directory
20ENOTDIR +Not a directory
19ENODEV +No such device
18EXDEV +Invalid cross-device link
17EEXIST +File exists
16EBUSY +Device or resource busy
15ENOTBLK Block device required
14 EFAULT +Bad address
13EACCES +Permission denied
12ENOMEM +Cannot allocate memory
11EAGAIN +Resource temporarily unavailable
10ECHILD +No child processes
9EBADF +Bad file descriptor
8ENOEXEC +Exec format error
7E2BIG +Argument list too long
6ENXIO +No such device or address
5EIO +Input/output error
4EINTR +Interrupted system call
3ESRCH +No such process
2ENOENT +No such file or directory
1EPERM +Operation not permitted
# 0-- Success
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。