常見錯誤
ECONNREFUSED(111): 沒有這個端口
EAGAIN(11): buff已滿
EPIPE(32): 客戶端斷掉了
ECONNRESET(104): 客戶端先可以正常連接服務端,并可以進行數據收發(fā),
但當客戶端突然掉電,即沒有正常的關掉網絡資源,
重啟后,客戶端還是可以連接服務端,但是發(fā)送(send函數)數據給服務端時,
send函數返回-1,捕捉errno為104,即ECONNRESET。
ENOBUFS(105): 例如:使用udp發(fā)送>=128K的消息會報ENOBUFS的錯誤
EPIPE和ECONNRESET區(qū)別
EPIPE和ECONNRESET是網絡編程實踐中很常見的錯誤。二者都是出現(xiàn)send調用出錯的時候,可它們有什么區(qū)別呢? 簡而言之,二者的區(qū)別是本端的socket是否收到過對方socket發(fā)出的FIN。
/* When we get a reset we do this. */
static void tcp_reset(struct sock *sk)
{
/* We want the right error as BSD sees it (and indeed as we do). */
switch (sk->sk_state) {
case TCP_SYN_SENT:
sk->sk_err = ECONNREFUSED;
break;
case TCP_CLOSE_WAIT:
sk->sk_err = EPIPE;
break;
case TCP_CLOSE:
return;
default:
sk->sk_err = ECONNRESET;
}
/* This barrier is coupled with smp_rmb() in tcp_poll() */
smp_wmb();
if (!sock_flag(sk, SOCK_DEAD))
sk->sk_error_report(sk);
tcp_done(sk);
}
附錄
1 #define EPERM 1 // Operation not permitted 操作不允許
2 #define ENOENT 2 // No such file or directory 文件/路徑不存在
3 #define ESRCH 3 // No such process 進程不存在
4 #define EINTR 4 // Interrupted system call 中斷的系統(tǒng)調用
5 #define EIO 5 // I/O error I/O錯誤
6 #define ENXIO 6 // No such device or address 設備/地址不存在
7 #define E2BIG 7 // Arg list too long 參數列表過長
8 #define ENOEXEC 8 // Exec format error 執(zhí)行格式錯誤
9 #define EBADF 9 // Bad file number 錯誤文件編號
10 #define ECHILD 10 // No child processes 子進程不存在
11 #define EAGAIN 11 // Try again 重試
12 #define ENOMEM 12 // Out of memory 內存不足
13 #define EACCES 13 // Permission denied 無權限
14 #define EFAULT 14 // Bad address 地址錯誤
15 #define ENOTBLK 15 // Block device required 需要塊設備
16 #define EBUSY 16 // Device or resource busy 設備或資源忙
17 #define EEXIST 17 // File exists 文件已存在
18 #define EXDEV 18 // Cross-device link 跨設備鏈路
19 #define ENODEV 19 // No such device 設備不存在
20 #define ENOTDIR 20 // Not a directory 路徑不存在
21 #define EISDIR 21 // Is a directory 是路徑
22 #define EINVAL 22 // Invalid argument 無效參數
23 #define ENFILE 23 // File table overflow 文件表溢出
24 #define EMFILE 24 // Too many open files 打開的文件過多
25 #define ENOTTY 25 // Not a typewriter 非打字機
26 #define ETXTBSY 26 // Text file busy 文本文件忙
27 #define EFBIG 27 // File too large 文件太大
28 #define ENOSPC 28 // No space left on device 設備無空間
29 #define ESPIPE 29 // Illegal seek 非法查詢
30 #define EROFS 30 // Read-only file system 只讀文件系統(tǒng)
31 #define EMLINK 31 // Too many links 鏈接太多
32 #define EPIPE 32 // Broken pipe 管道破裂
33 #define EDOM 33 // Math argument out of domain of func 參數超出函數域
34 #define ERANGE 34 // Math result not representable 結果無法表示
35 #define EDEADLK 35 // Resource deadlock would occur 資源將發(fā)生死鎖
36 #define ENAMETOOLONG 36 // File name too long 文件名太長
37 #define ENOLCK 37 // No record locks available 沒有可用的記錄鎖
38 #define ENOSYS 38 // Function not implemented 函數未實現(xiàn)
39 #define ENOTEMPTY 39 // Directory not empty 目錄非空
40 #define ELOOP 40 // Too many symbolic links encountered 遇到太多符號鏈接
41 #define EWOULDBLOCK EAGAIN // Operation would block 操作會阻塞
42 #define ENOMSG 42 // No message of desired type 沒有符合需求類型的消息
43 #define EIDRM 43 // Identifier removed 標識符已刪除
44 #define ECHRNG 44 // Channel number out of range 通道編號超出范圍
45 #define EL2NSYNC 45 // Level 2 not synchronized level2不同步
46 #define EL3HLT 46 // Level 3 halted 3級停止
47 #define EL3RST 47 // Level 3 reset 3級重置
48 #define ELNRNG 48 // Link number out of range 鏈接編號超出范圍
49 #define EUNATCH 49 // Protocol driver not attached 協(xié)議驅動程序沒有連接
50 #define ENOCSI 50 // No CSI structure available 沒有可用的CSI結構
51 #define EL2HLT 51 // Level 2 halted 2級停止
52 #define EBADE 52 // Invalid exchange 無效交換
53 #define EBADR 53 // Invalid request descriptor 無效請求描述
54 #define EXFULL 54 // Exchange full 交換完全
55 #define ENOANO 55 // No anode 無陽極
56 #define EBADRQC 56 // Invalid request code 無效請求碼
57 #define EBADSLT 57 // Invalid slot 無效插槽
58 #define EDEADLOCK EDEADLK
59 #define EBFONT 59 // Bad font file format 錯誤的字體文件格式
60 #define ENOSTR 60 // Device not a stream 設備不是流
61 #define ENODATA 61 // No data available 無數據
62 #define ETIME 62 // Timer expired 計時器到期
63 #define ENOSR 63 // Out of streams resources 流資源不足
64 #define ENONET 64 // Machine is not on the network 機器不在網絡上
65 #define ENOPKG 65 // Package not installed 包未安裝
66 #define EREMOTE 66 // Object is remote 對象是遠程
67 #define ENOLINK 67 // Link has been severed 鏈接正在服務中
68 #define EADV 68 // Advertise error 廣告錯誤
69 #define ESRMNT 69 // Srmount error ?
70 #define ECOMM 70 // Communication error on send 發(fā)送過程中通訊錯誤
71 #define EPROTO 71 // Protocol error 協(xié)議錯誤
72 #define EMULTIHOP 72 // Multihop attempted 多跳嘗試
73 #define EDOTDOT 73 // RFS specific error RFS特定錯誤
74 #define EBADMSG 74 // Not a data message 不是數據類型消息
75 #define EOVERFLOW 75 // Value too large for defined data type 對指定的數據類型來說值太大
76 #define ENOTUNIQ 76 // Name not unique on network 網絡上名字不唯一
77 #define EBADFD 77 // File descriptor in bad state 文件描述符狀態(tài)錯誤
78 #define EREMCHG 78 // Remote address changed 遠程地址改變
79 #define ELIBACC 79 // Can not access a needed shared library 無法訪問需要的共享庫
80 #define ELIBBAD 80 // Accessing a corrupted shared library 訪問損壞的共享庫
81 #define ELIBSCN 81 // .lib section in a.out corrupted 庫部分在a.out損壞
82 #define ELIBMAX 82 // Attempting to link in too many shared libraries 試圖鏈接太多的共享庫
83 #define ELIBEXEC 83 // Cannot exec a shared library directly 不能直接運行共享庫
84 #define EILSEQ 84 // Illegal byte sequence 非法字節(jié)序
85 #define ERESTART 85 // Interrupted system call should be restarted 應重新啟動被中斷的系統(tǒng)調用
86 #define ESTRPIPE 86 // Streams pipe error 流管錯誤
87 #define EUSERS 87 // Too many users 用戶太多
88 #define ENOTSOCK 88 // Socket operation on non-socket 在非套接字上進行套接字操作
89 #define EDESTADDRREQ 89 // Destination address required 需要目的地址
90 #define EMSGSIZE 90 // Message too long 消息太長
91 #define EPROTOTYPE 91 // Protocol wrong type for socket 錯誤協(xié)議類型
92 #define ENOPROTOOPT 92 // Protocol not available 協(xié)議不可用
93 #define EPROTONOSUPPORT 93 // Protocol not supported 不支持協(xié)議
94 #define ESOCKTNOSUPPORT 94 // Socket type not supported 不支持套接字類型
95 #define EOPNOTSUPP 95 // Operation not supported on transport endpoint 操作上不支持傳輸端點
96 #define EPFNOSUPPORT 96 // Protocol family not supported 不支持協(xié)議族
97 #define EAFNOSUPPORT 97 // Address family not supported by protocol 協(xié)議不支持地址群
98 #define EADDRINUSE 98 // Address already in use 地址已被使用
99 #define EADDRNOTAVAIL 99 // Cannot assign requested address 無法分配請求的地址
100 #define ENETDOWN 100 // Network is down 網絡已關閉
101 #define ENETUNREACH 101 // Network is unreachable 網絡不可達
102 #define ENETRESET 102 // Network dropped connection because of reset 網絡由于復位斷開連接
103 #define ECONNABORTED 103 // Software caused connection abort 軟件導致連接終止
104 #define ECONNRESET 104 // Connection reset by peer 連接被對方復位
105 #define ENOBUFS 105 // No buffer space available 沒有可用的緩存空間
106 #define EISCONN 106 // Transport endpoint is already connected 傳輸端點已連接
107 #define ENOTCONN 107 // Transport endpoint is not connected 傳輸端點未連接
108 #define ESHUTDOWN 108 // Cannot send after transport endpoint shutdown 傳輸端點關閉后不能在發(fā)送
109 #define ETOOMANYREFS 109 // Too many references: cannot splice 太多的引用:無法接合
110 #define ETIMEDOUT 110 // Connection timed out 連接超時
111 #define ECONNREFUSED 111 // Connection refused 連接被拒絕
112 #define EHOSTDOWN 112 // Host is down 主機已關閉
113 #define EHOSTUNREACH 113 // No route to host 無法路由到主機
114 #define EALREADY 114 // Operation already in progress 操作已在進程中
115 #define EINPROGRESS 115 // Operation now in progress 進程中正在進行的操作
116 #define ESTALE 116 // Stale NFS file handle
117 #define EUCLEAN 117 // Structure needs cleaning
118 #define ENOTNAM 118 // Not a XENIX named type file
119 #define ENAVAIL 119 // No XENIX semaphores available
120 #define EISNAM 120 // Is a named type file
121 #define EREMOTEIO 121 // Remote I/O error
122 #define EDQUOT 122 // Quota exceeded
123 #define ENOMEDIUM 123 // No medium found
124 #define EMEDIUMTYPE 124 // Wrong medium type
出現(xiàn)網絡聯(lián)機錯誤Socket error #11001
表示您的計算機無法連上服務器,請檢查您的Proxy設定以及Proxy相關賬號,或暫時取消您防毒軟件的「個人防火墻」。
· 出現(xiàn)網絡聯(lián)機錯誤Socket error #11004
應該是網絡聯(lián)機狀態(tài)問題,請用戶檢查網絡聯(lián)機是否正常。
· 出現(xiàn)網絡聯(lián)機錯誤Socket error #10060 Connection Timed Out
表示您與服務器發(fā)生聯(lián)機逾時錯誤,請檢查您的Proxy相關設定,以及Proxy Server是否已將SSL 443 port打開。
· 出現(xiàn)網絡聯(lián)機錯誤Socket error #10061
表示服務器忙碌中無法與您建立聯(lián)機,請稍后再試。
· 出現(xiàn)網絡聯(lián)機錯誤Socket error #10022
請您上網更新Windows操作系統(tǒng)組件。Windows NT version 4.0的用戶請下載安裝 Service Pack 5(含)以上。
· 出現(xiàn)Internal Server Error
主機忙碌中,請您稍后再試。
· 上傳時出現(xiàn)Socket error #10022 Invalid argument.
請上網更新Windows操作系統(tǒng)組件(windows update)。Windows NT version 4.0的用戶請下載安裝 Service Pack 5(含)以上。
· 上傳時出現(xiàn)socket error #10054 Connection reset by peer
原因為連接被防火檣或proxy中斷"或因為您有安裝ip分享器請將ip分享器先拿掉,直接將計算機接adsl的線路后重新上傳。
· 上傳時出現(xiàn)socket error #10057 Connection reset by peer
是windows的系統(tǒng)文件,與文件傳輸又關系. 所以你刪除了,不能提交命令,網頁不能下載,就不能上網咯
一些程序經常會劫持IE、修改winsock,我們可以清除他們但是后果是上不去網了。很多軟件都可以修復winsock,但是設想一下這種情況,如果你正好手邊沒有軟件,而且也上不去網,你會怎么辦。有人就說了,拿U盤去別的地方下啊。其實不必那么麻煩,windows xp已經自己帶了修復自己的工具,那就是netsh。下次如果在刪除病毒程序后上不去網了,直接在運行里鍵入netsh winsock reset
Q.為什么下載到99%會速度會減慢甚至會暫停一段時間
A.下載接近完成的時候一般只剩下一兩個連接,由于其他連接的關閉,導致下載速度較慢,如果這一兩個連接再出現(xiàn)連接和下載線路不通暢,就會導致長時間的停頓,在快車中已就該情況進行了一些特殊處理,不過有時依然會有問題,可以設置超時時間為一個較小的值,可以改進一些,不過對正常的下載又有一些影響。最好不要理它,等一段時間就會下載完成。如果著急,可以手動停止再啟動。
Q.下載后的文件無法打開,提示“沒有關聯(lián)的程序”或者提示要用打開方式
A.有三種可能性:
1.由于一些網站的限制或者用戶提交給快車下載的地址的錯誤,快車不能正確下載文件,只是下載了一些頁面文件,有時這些頁面是服務器動態(tài)生成的,文件后綴為php,asp等等,請參照常見問題解答中的相關問題答案確??燔嚳梢韵螺d到正確的文件
2.沒有安裝處理下載的文件的相關程序,比如后綴為zip的文件,需要安裝解壓縮程序(WinZip等)
3.快車會給未下載完成的文件添加.jc!的后綴,下載完成后會去掉該后綴,可能由于一些特殊的情況(安裝了某些實時病毒 監(jiān)測軟件)造成無法自動完成該工作,請手動去掉已下載文件的.jc!后綴。另外在選項/常規(guī)中去掉設置"添加后綴jc!直到 文件下載完成"以后就不會有該問題。
Q.為何已經下載完的任務仍留在“正在下載”類別中,而并沒有自動移動到“已下載”類別中
A.請在菜單/工具/默認下載屬性中修改類別屬性為"已下載",以后添加的任務下載完畢后會自動移動到“已下載”類別,當前已下載完畢而仍在“正在下載”類別中的任務可以托拽到“已下載”類別中。
Q.提示"Socket Error 100xx"
A.如果所有的站點均是如此,請確保你與Internet的連接沒有問題(如果使用代理服務器請確保在快車中設置的正確,如果使用了防火墻也需要在防火墻軟件中設置允許快車訪問因特網,具體需要參閱防火墻軟件的幫助文件),另外也有可能是由于創(chuàng)建了過多的連接導致的,請不要同時下載太多的文件。如果只是個別站點如此,應該是該站點臨時有點問題或者根本無法連接該站點(比如國內封掉了某些IP),請過些時候再試。
如對本文有疑問,請?zhí)峤坏浇涣髡搲?,廣大熱心網友會為你解答!! 點擊進入論壇