亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频

? 歡迎來到蟲蟲下載站! | ?? 資源下載 ?? 資源專輯 ?? 關于我們
? 蟲蟲下載站

?? socketapi.cpp

?? 天之煉獄1服務器端源文件游戲服務端不完整
?? CPP
?? 第 1 頁 / 共 3 頁
字號:
////////////////////////////////////////////////////////////////////////// SocketAPI.cpp//// by Reiot, the Fallen Lord of MUDMANIA(TM)//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// include files//////////////////////////////////////////////////#include "SocketAPI.h"#if __WINDOWS__#elif __LINUX__#include <sys/types.h>			// for accept()#include <sys/socket.h>#include <sys/time.h>#include <arpa/inet.h>			// for inet_xxx()#include <netinet/in.h>#include <errno.h>				// for errno#endif#include "FileAPI.h"//////////////////////////////////////////////////// external variable//////////////////////////////////////////////////#if __LINUX__extern int errno;#endifusing namespace FileAPI;////////////////////////////////////////////////////////////////////////// SOCKET SocketAPI::socket_ex ( int domain , int type , int protocol ) //		throw ( Error )//// exception version of socket()//// Parameters//     domain - AF_INET(internet socket), AF_UNIX(internal socket), ...//	   type  - SOCK_STREAM(TCP), SOCK_DGRAM(UDP), ...//     protocol - 0//// Return //     socket descriptor//// Exceptions//     Error////////////////////////////////////////////////////////////////////////SOCKET SocketAPI::socket_ex ( int domain , int type , int protocol ) 	throw ( Error ){	__BEGIN_TRY	SOCKET s = ::socket(domain,type,protocol);	if ( s == INVALID_SOCKET ) {#if __LINUX__		switch ( errno ) {		case EPROTONOSUPPORT :			throw Error("The protocol type or the specified protocol is not supported within this domain.");		case EMFILE : 			throw Error("The per-process descriptor table is full.");		case ENFILE : 			throw Error("The system file table is full.");		case EACCES : 			throw Error("Permission to create a socket of the specified type and/or protocol is denied.");		case ENOBUFS : 			throw Error("Insufficient buffer space is available. The socket cannot be created until sufficient resources are freed.");		default : 			throw UnknownError(strerror(errno),errno);		}//end of switch#elif __WINDOWS__		switch ( WSAGetLastError() ) {		case WSANOTINITIALISED : 			throw Error("A successful WSAStartup must occur before using this function.");		case WSAENETDOWN : 			throw Error("The network subsystem or the associated service provider has failed.");		case WSAEAFNOSUPPORT : 			throw Error("The specified address family is not supported.");		case WSAEINPROGRESS : 			throw Error("A blocking Windows Sockets 1.1 call is in progress, or the service provider is still processing a callback function.");		case WSAEMFILE : 			throw Error("No more socket descriptors are available.");		case WSAENOBUFS : 			throw Error("No buffer space is available. The socket cannot be created.");		case WSAEPROTONOSUPPORT : 			throw Error("The specified protocol is not supported.");		case WSAEPROTOTYPE : 			throw Error("The specified protocol is the wrong type for this socket.");		case WSAESOCKTNOSUPPORT : 			throw Error("The specified socket type is not supported in this address family.");		default : 			throw UnknownError("socket()");		}//end of switch#endif	}	return s;		__END_CATCH}////////////////////////////////////////////////////////////////////////// void SocketAPI::bind_ex ( SOCKET s , const struct sockaddr * addr , uint addrlen ) //      throw ( MBindException , //              Error );//// exception version of bind()//// Parameters//     s       - socket descriptor //     addr    - socket address structure ( normally struct sockaddr_in )//     addrlen - length of socket address structure//// Return//     none//// Exceptions//     MBindException//     Error////////////////////////////////////////////////////////////////////////void SocketAPI::bind_ex ( SOCKET s , const struct sockaddr * addr , uint addrlen )      throw ( BindException ,              Error ){	__BEGIN_TRY	if ( bind ( s , addr , addrlen ) == SOCKET_ERROR ) {#if __LINUX__		switch ( errno ) {		case EADDRINUSE :			throw BindException("The address is already in use. kill another server or use another port. 家南狼 林家 趣籃 器飄啊 撈固 葷儈吝澇聰促. 扁糧狼 輯滾 家南闌 輛豐竅芭唱, 促弗 器飄甫 葷儈竅矯扁 官而聰促.");		case EINVAL : 			throw BindException("The socket is already bound to an address , or the addr_len was wrong, or the socket was not in the AF_UNIX family.");		case EACCES : 			throw BindException("The address is protected, and the user is not the super-user. or search permission is denied on a component of the path prefix.");		case ENOTSOCK : 			throw Error("Argument is a descriptor for a file, not a socket. The following errors are specific to UNIX domain (AF_UNIX) sockets:");		case EBADF : 			throw Error("sockfd is not a valid descriptor.");		case EROFS : 			throw Error("The socket inode would reside on a read-only file system.");		case EFAULT : 			throw Error("my_addr points outside your accessible address space.");		case ENAMETOOLONG : 			throw Error("my_addr is too long.");		case ENOENT : 			throw Error("The file does not exist.");		case ENOMEM : 			throw Error("Insufficient kernel memory was available.");		case ENOTDIR : 			throw Error("A component of the path prefix is not a directory.");		case ELOOP : 			throw Error("Too many symbolic links were encountered in resolving my_addr.");		default :			throw UnknownError(strerror(errno),errno);		}//end of switch#elif __WINDOWS__		switch ( WSAGetLastError() ) {		case WSANOTINITIALISED : 			throw Error("A successful WSAStartup must occur before using this function.");		case WSAENETDOWN : 			throw Error("The network subsystem has failed.");		case WSAEADDRINUSE : 			throw BindException("A process on the machine is already bound to the same fully-qualified address and the socket has not been marked to allow address re-use with SO_REUSEADDR. For example, IP address and port are bound in the af_inet case) . (See the SO_REUSEADDR socket option under setsockopt.)");		case WSAEADDRNOTAVAIL : 			throw BindException("The specified address is not a valid address for this machine.");		case WSAEFAULT : 			throw BindException("The name or the namelen parameter is not a valid part of the user address space, the namelen parameter is too small, the name parameter contains incorrect address format for the associated address family, or the first two bytes of the memory block specified by name does not match the address family associated with the socket descriptor s.");		case WSAEINPROGRESS : 			throw Error("A blocking Windows Sockets 1.1 call is in progress, or the service provider is still processing a callback function.");		case WSAEINVAL : 			throw BindException("The socket is already bound to an address.");		case WSAENOBUFS : 			throw Error("Not enough buffers available, too many connections.");		case WSAENOTSOCK : 			throw Error("The descriptor is not a socket.");		default :			throw UnknownError("bind()");		}//end of switch#endif	}		__END_CATCH}////////////////////////////////////////////////////////////////////////// void SocketAPI::connect_ex ( SOCKET s , const struct sockaddr * addr , uint addrlen )//      throw ( ConnectException , //              NonBlockingIOException , //              Error );//// exception version of connect() system call//// Parameters//     s       - socket descriptor//     addr    - socket address structure//     addrlen - length of socket address structure//// Return//     none//// Exceptions//     ConnectException//     NonBlockingIOException//     Error////////////////////////////////////////////////////////////////////////void SocketAPI::connect_ex ( SOCKET s , const struct sockaddr * addr , uint addrlen )     throw ( ConnectException ,              NonBlockingIOException ,              Error ){	__BEGIN_TRY	if ( connect(s,addr,addrlen) == SOCKET_ERROR ) {#if __LINUX__		switch ( errno ) {		case EALREADY : 			throw NonBlockingIOException("The socket is non-blocking and a previous connection attempt has not yet been completed.");		case EINPROGRESS : 			throw ConnectException("The socket is non-blocking and the connection can not be completed immediately.");		case ECONNREFUSED : 			throw ConnectException("Connection refused at server.");		case EISCONN : 			throw ConnectException("The socket is already connected.");		case ETIMEDOUT : 			throw ConnectException("Timeout while attempting connection.");		case ENETUNREACH : 			throw ConnectException("Network is unreachable.");		case EADDRINUSE : 			throw ConnectException("Address is already in use.");		case EBADF : 			throw Error("Bad descriptor.");		case EFAULT : 			throw Error("The socket structure address is outside your address space.");		case ENOTSOCK : 			throw Error("The descriptor is not associated with a socket.");		default :			throw UnknownError(strerror(errno),errno);		}//end of switch#elif __WINDOWS__		switch ( WSAGetLastError() ) {		case WSANOTINITIALISED : 			throw Error("A successful WSAStartup must occur before using this function.");		case WSAENETDOWN : 			throw Error("The network subsystem has failed.");		case WSAEADDRINUSE : 			throw Error("The socket's local address is already in use and the socket was not marked to allow address reuse with SO_REUSEADDR. This error usually occurs when executing bind, but could be delayed until this function if the bind was to a partially wild-card address (involving ADDR_ANY) and if a specific address needs to be committed at the time of this function.");		case WSAEINTR : 			throw Error("The (blocking) Windows Socket 1.1 call was canceled through WSACancelBlockingCall.");		case WSAEINPROGRESS : 			throw Error("A blocking Windows Sockets 1.1 call is in progress, or the service provider is still processing a callback function.");		case WSAEALREADY : 			throw Error("A nonblocking connect call is in progress on the specified socket. Note In order to preserve backward compatibility, this error is reported as WSAEINVAL to Windows Sockets 1.1 applications that link to either WINSOCK.DLL or WSOCK32.DLL."); 		case WSAEADDRNOTAVAIL : 			throw ConnectException("The remote address is not a valid address (such as ADDR_ANY).");		case WSAEAFNOSUPPORT : 			throw Error("Addresses in the specified family cannot be used with this socket.");		case WSAECONNREFUSED : 			throw ConnectException("The attempt to connect was forcefully rejected.");		case WSAEFAULT : 			throw Error("The name or the namelen parameter is not a valid part of the user address space, the namelen parameter is too small, or the name parameter contains incorrect address format for the associated address family.");		case WSAEINVAL : 			throw Error("The parameter s is a listening socket, or the destination address specified is not consistent with that of the constrained group the socket belongs to.");		case WSAEISCONN : 			throw ConnectException("The socket is already connected (connection-oriented sockets only).");		case WSAENETUNREACH : 			throw ConnectException("The network cannot be reached from this host at this time.");		case WSAENOBUFS : 			throw Error("No buffer space is available. The socket cannot be connected.");		case WSAENOTSOCK : 			throw Error("The descriptor is not a socket.");		case WSAETIMEDOUT : 			throw ConnectException("Attempt to connect timed out without establishing a connection.");		case WSAEWOULDBLOCK  : 			throw NonBlockingIOException("The socket is marked as nonblocking and the connection cannot be completed immediately.");		default :			throw UnknownError("connect()");		}//end of switch#endif	}		__END_CATCH}////////////////////////////////////////////////////////////////////////// void SocketAPI::listen_ex ( SOCKET s , uint backlog )//      throw ( Error );//// exception version of listen()//// Parameters//     s       - socket descriptor//     backlog - waiting queue length//// Return//     none//// Exceptions//     Error////////////////////////////////////////////////////////////////////////void SocketAPI::listen_ex ( SOCKET s , uint backlog )      throw ( Error ){	__BEGIN_TRY	if ( listen( s , backlog ) == SOCKET_ERROR ) {#if __LINUX__		switch ( errno ) {		case EBADF : 			throw Error("Bad descriptor.");		case ENOTSOCK :			throw Error("Not a socket.");		case EOPNOTSUPP :			throw Error("The socket is not of a type that supports the operation listen.");		default :			throw UnknownError(strerror(errno),errno);		}//end of switch#elif __WINDOWS__		switch ( WSAGetLastError() ) {		case WSANOTINITIALISED : 			throw Error("A successful WSAStartup must occur before using this function.");		case WSAENETDOWN : 			throw Error("The network subsystem has failed.");		case WSAEADDRINUSE : 			throw Error("The socket's local address is already in use and the socket was not marked to allow address reuse with SO_REUSEADDR. This error usually occurs during execution of the bind function, but could be delayed until this function if the bind was to a partially wild-card address (involving ADDR_ANY) and if a specific address needs to be 'committed' at the time of this function.");		case WSAEINPROGRESS : 			throw Error("A blocking Windows Sockets 1.1 call is in progress, or the service provider is still processing a callback function.");		case WSAEINVAL : 			throw Error("The socket has not been bound with bind.");		case WSAEISCONN : 			throw Error("The socket is already connected.");		case WSAEMFILE : 			throw Error("No more socket descriptors are available.");		case WSAENOBUFS : 			throw Error("No buffer space is available.");		case WSAENOTSOCK : 			throw Error("The descriptor is not a socket.");		case WSAEOPNOTSUPP : 			throw Error("The referenced socket is not of a type that supports the listen operation.");		default :			throw UnknownError("listen()");		}//end of switch#endif	}		__END_CATCH}//////////////////////////////////////////////////////////////////////////SOCKET SocketAPI::accept_ex ( SOCKET s , struct sockaddr * addr , uint * addrlen ) //       throw ( NonBlockingIOException , //               ConnectException ,//               Error );//// exception version of accept()//// Parameters//     s       - socket descriptor//     addr    - socket address structure//     addrlen - length of socket address structure//// Return//     none//// Exceptions//     NonBlockingIOException//     Error////////////////////////////////////////////////////////////////////////SOCKET SocketAPI::accept_ex ( SOCKET s , struct sockaddr * addr , uint * addrlen )       throw ( NonBlockingIOException , ConnectException , Error ){	__BEGIN_TRY#if __LINUX__	SOCKET client = accept( s , addr , addrlen );#elif __WINDOWS__	SOCKET client = accept( s , addr , (int*)addrlen );#endif		if ( client == INVALID_SOCKET ) {#if __LINUX__		switch ( errno ) {		case EWOULDBLOCK : 			throw NonBlockingIOException();		case ECONNRESET :		case ECONNABORTED :		case EPROTO :		case EINTR :			// from UNIX Network Programming 2nd, 15.6			// with nonblocking-socket, ignore above errors			throw ConnectException(strerror(errno));		case EBADF : 		case ENOTSOCK : 		case EOPNOTSUPP : 		case EFAULT : 			throw Error(strerror(errno));		default :			throw UnknownError(strerror(errno),errno);		}//end of switch#elif __WINDOWS__		switch ( WSAGetLastError() ) {		case WSANOTINITIALISED : 			throw Error("A successful WSAStartup must occur before using this FUNCTION.");		case WSAENETDOWN : 			throw Error("The network subsystem has failed.");		case WSAEFAULT : 			throw Error("The addrlen parameter is too small or addr is not a valid part of the user address space.");		case WSAEINTR : 			throw Error("A blocking Windows Sockets 1.1 call was canceled through WSACancelBlockingCall.");		case WSAEINPROGRESS : 

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
美女网站在线免费欧美精品| 欧美日韩国产一区二区三区地区| 欧美一区二区三区四区高清| 婷婷六月综合亚洲| 日韩美一区二区三区| 国产精品一二三四区| 综合激情成人伊人| 欧美欧美欧美欧美首页| 欧美日韩一区二区三区高清| 国产九九视频一区二区三区| 国产一区二区h| 亚洲国产精品人人做人人爽| 日韩一区二区三区电影| 91同城在线观看| 亚洲一区自拍偷拍| 久久久久久久综合| 精品视频在线免费| 6080午夜不卡| 一本色道久久综合亚洲aⅴ蜜桃| 日本亚洲最大的色成网站www| 中文字幕日韩欧美一区二区三区| 欧美高清hd18日本| 91丨九色丨蝌蚪富婆spa| 91蜜桃免费观看视频| 欧美专区亚洲专区| 成人福利视频网站| 免费黄网站欧美| 亚洲大片免费看| 亚洲免费视频中文字幕| 国产无人区一区二区三区| 欧美日韩另类一区| 欧美大片国产精品| 国产精品欧美综合在线| 日韩一区二区免费视频| 国产网站一区二区| 日韩伦理电影网| 青青草97国产精品免费观看无弹窗版| 韩国视频一区二区| 久久精品国产久精国产爱| 婷婷夜色潮精品综合在线| 国产一区二区中文字幕| 92国产精品观看| gogo大胆日本视频一区| 国产成人综合网| 国内精品伊人久久久久影院对白| 成人动漫在线一区| 666欧美在线视频| 中文字幕高清一区| 国产精品欧美一区二区三区| 亚洲成人av福利| 国产成人综合精品三级| 欧美日韩国产精选| 久久久99精品免费观看不卡| 亚洲一区二区三区中文字幕| 国产麻豆午夜三级精品| 欧美在线看片a免费观看| 欧美xxxxxxxxx| 欧美精品一区二区三区高清aⅴ| 精品国产成人在线影院| 亚洲免费观看高清完整版在线观看| 美女高潮久久久| 色综合久久六月婷婷中文字幕| 欧美一区二区黄色| 亚洲欧美国产三级| 国产精品18久久久久久久久久久久| 欧美系列亚洲系列| 欧美少妇xxx| 国产精品久久久久久久久免费桃花| 国产精品欧美经典| 免费成人结看片| 91久久精品一区二区三区| 欧美日韩中文字幕一区二区| 日本一区二区免费在线观看视频 | 国产精品亚洲专一区二区三区 | 亚洲特黄一级片| 韩国v欧美v亚洲v日本v| 在线亚洲人成电影网站色www| 久久久午夜精品理论片中文字幕| 天堂一区二区在线免费观看| 人禽交欧美网站| 91国偷自产一区二区三区观看| 久久女同精品一区二区| 久久精品国产久精国产| 欧美视频中文字幕| 亚洲男人天堂一区| 国产精品资源在线| 欧美va在线播放| 不卡的av网站| 久久精品欧美一区二区三区不卡 | 爽好久久久欧美精品| 91麻豆国产福利精品| 欧美激情一区二区在线| 国产成人在线网站| 欧美精品一区二区久久久| 蜜臀va亚洲va欧美va天堂| 在线综合+亚洲+欧美中文字幕| 一区二区三区丝袜| 免费欧美高清视频| 欧美一区二区三区在| 三级欧美韩日大片在线看| 欧美日韩亚洲国产综合| 亚洲bt欧美bt精品777| 欧美色老头old∨ideo| 一区二区三区国产精华| 欧美视频一区在线| 午夜精品一区二区三区电影天堂 | 欧美成人aa大片| 久久精品国产**网站演员| 欧美v国产在线一区二区三区| 全部av―极品视觉盛宴亚洲| 欧美片网站yy| 精品一区二区三区免费| 99国产精品一区| 亚洲综合一区在线| 欧美日韩一级片在线观看| 亚洲成人777| 欧美一卡2卡三卡4卡5免费| 蜜臀av亚洲一区中文字幕| 精品国产免费一区二区三区香蕉| 国产在线一区观看| 国产精品女人毛片| 91福利在线免费观看| 亚洲成人av一区二区| 精品欧美久久久| 国产成人欧美日韩在线电影| 中文字幕一区二区三区视频| 欧洲一区在线观看| 日韩av不卡在线观看| 国产亚洲精品免费| 91丨国产丨九色丨pron| 视频一区在线视频| 久久综合一区二区| 日韩激情中文字幕| 亚洲精品一区二区三区在线观看| 国产成人在线免费观看| 中文字幕亚洲不卡| 欧美日本在线一区| 国产一区二区三区| 一区二区三区在线观看视频| 91精品国产综合久久精品性色| 国产在线精品一区二区夜色| 中文字幕日本乱码精品影院| 欧美欧美欧美欧美| 国产成人精品影视| 一区二区三区四区乱视频| 精品国产在天天线2019| 91首页免费视频| 日本不卡视频在线观看| 国产精品色眯眯| 欧美精品久久久久久久多人混战| 国产综合久久久久久久久久久久| 亚洲欧美怡红院| 欧美α欧美αv大片| 91色综合久久久久婷婷| 麻豆极品一区二区三区| 一区二区三区四区在线| 精品99999| 欧美午夜精品久久久| 丁香天五香天堂综合| 91超碰这里只有精品国产| 国产精品亚洲午夜一区二区三区| 亚洲成人自拍偷拍| 日本一区二区三区在线观看| 91精品久久久久久久99蜜桃| 99国产精品99久久久久久| 久久国产精品99精品国产 | 26uuuu精品一区二区| 国产成人亚洲综合色影视| 国产精品一区在线观看你懂的| 欧美剧情片在线观看| 日韩欧美第一区| 日韩精品乱码av一区二区| 亚洲综合一区二区| 久草在线在线精品观看| 欧美美女bb生活片| 精品88久久久久88久久久| 国产精品久久久久7777按摩| 久久99国产精品免费网站| 91蝌蚪porny九色| 免费观看在线色综合| 亚洲国产精品久久艾草纯爱 | 久久久亚洲精华液精华液精华液 | 亚洲欧洲三级电影| 精品国产麻豆免费人成网站| 欧美亚洲禁片免费| 不卡影院免费观看| 国产精品99久久久| 蜜桃视频一区二区| 日韩影院精彩在线| 亚洲影视在线观看| 亚洲天堂2014| 国产精品久久久久久一区二区三区| 精品久久人人做人人爽| 制服.丝袜.亚洲.中文.综合| 91美女视频网站| 99国产麻豆精品| 99久久99久久精品免费观看| 国产成人亚洲精品狼色在线| 国模一区二区三区白浆| 蜜桃久久久久久|