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

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

?? icmp.cpp

?? VC通信程序源代碼.TCP/UDP高級編程,TCP,IP終端程序源代碼等.
?? CPP
?? 第 1 頁 / 共 3 頁
字號:
	icmpCurSeq = copy.icmpCurSeq;
	icmpCurId = copy.icmpCurId;
	icmpRcvLen = copy.icmpRcvLen;
}

/////////////////////////////////////////////////////////////////////////////
// CIcmp member functions

//////////////////////////////////////////////////////////////////////////////////
//																				//
//		OpenNewSocket															//
//			Opens a SOCKET connection to a RAW socket with ICMP protocol.		//
//																				//
//			Requires a handle to a message processor which will process the		//
//			socket events, the message number to process, and a mask giving		//
//			the events to process.												//
//																				//
//			Sets icmpSocketError and icmpSocketErrorMod to indicate the type	//
//			of error, and returns TRUE if successful, else FALSE.				//
//																				//
//			icmpSocketError and icmpSocketErrorMod are preserved until the next	//
//			operation on this Icmp object is performed.							//
//																				//
//////////////////////////////////////////////////////////////////////////////////
//打開一個SOCKET連接使用ICMP協議,需要一個句柄去處理socket事件,
BOOL CIcmp::OpenNewSocket(HWND hWnd, unsigned int NotificationMessage, long NotifyEvents)
{
	//調用另外一個多態函數
	return OpenNewSocket (hWnd,
						  NotificationMessage,
						  NotifyEvents,
						  AF_INET,
						  SOCK_RAW,
						  IPPROTO_ICMP);
}

//////////////////////////////////////////////////////////////////////////////////
//																				//
//		OpenNewSocket															//
//			Opens a SOCKET connection to a socket of specified family, type		//
//			and protocol														//
//																				//
//			Requires a handle to a message processor which will process the		//
//			socket events, the message number to process, and a mask giving		//
//			the events to process.												//
//																				//
//			Sets icmpSocketError and icmpSocketErrorMod to indicate the type	//
//			of error, and returns TRUE if successful, else FALSE.				//
//																				//
//			icmpSocketError and icmpSocketErrorMod are preserved until the next	//
//			operation on this Icmp object is performed.							//
//																				//
//////////////////////////////////////////////////////////////////////////////////
//打開一個連接,確定具體的family,類型和協議
BOOL CIcmp::OpenNewSocket(HWND hWnd, unsigned int NotificationMessage, long NotifyEvents, int AFamily, int AType, int AProtocol)
{

	if (icmpSocket != INVALID_SOCKET)
		CloseIcmpSocket();

	if (!Connect(&icmpPingTimer,
			    &icmpPingTimer,
			    AFamily,
			    AType,
			    AProtocol))
		return FALSE;
	//
	//		Set asynchronous notification and start message interrupt processor
	//

	if (SetAsynchNotification(hWnd,
		  					  NotificationMessage,
							  NotifyEvents) == SOCKET_ERROR)
	{
		return FALSE;
	}

	return TRUE;
}

//////////////////////////////////////////////////////////////////////////////////
//																				//
//		Connect																	//
//			Connects an Icmp object to a RAW socket with ICMP protocol.			//
//																				//
//			Requires 2 integer values specifying the receive and transmit		//
//			timeouts															//
//																				//
//			Sets icmpSocketError and icmpSocketErrorMod to indicate the type	//
//			of error, and returns TRUE if successful, else FALSE.				//
//																				//
//			icmpSocketError and icmpSocketErrorMod are preserved until the next	//
//			operation on this Icmp object is performed.							//
//																				//
//////////////////////////////////////////////////////////////////////////////////
//連接一個Icmp對象需要兩個整數變量來保存接收和發送超時時間
BOOL CIcmp::Connect(int ReceiveTimeout, int SendTimeout)
{

	return Connect(&ReceiveTimeout, 
				   &SendTimeout, 
				   AF_INET, 
				   SOCK_RAW, 
				   IPPROTO_ICMP);

}

//////////////////////////////////////////////////////////////////////////////////
//																				//
//		Connect																	//
//			Connects an Icmp object to a socket of specified family, type		//
//			and protocol														//
//																				//
//			Requires 2 integer values specifying the receive and transmit		//
//			timeouts, the ICMP family, ICMP socket type, and ICMP protocol.		//															//
//																				//
//			Sets icmpSocketError and icmpSocketErrorMod to indicate the type	//
//			of error, and returns TRUE if successful, else FALSE.				//
//																				//
//			icmpSocketError and icmpSocketErrorMod are preserved until the next	//
//			operation on this Icmp object is performed.							//
//																				//
//////////////////////////////////////////////////////////////////////////////////

BOOL CIcmp::Connect(LPINT ReceiveTimeout, LPINT SendTimeout, int AFamily, int AType, int AProtocol)
{

	int			Result;
	
	icmpSocket = NULL;

	icmpSocket = socket (AFamily,
						 AType,
						 AProtocol);

	if (icmpSocket == INVALID_SOCKET)
	{
		icmpSocketError = WSAGetLastError();
		icmpSocketErrorMod = 1;
		return FALSE;
	}
	
	//
	//		設定接收超時時間
	//

	Result = setsockopt (icmpSocket, 
					     SOL_SOCKET, 
						 SO_RCVTIMEO, 
						 (char *)ReceiveTimeout, 
						 sizeof(int));
	if (Result == SOCKET_ERROR)
	{
		icmpSocketError = WSAGetLastError();
		icmpSocketErrorMod = 2;
		closesocket (icmpSocket);
		icmpSocket = INVALID_SOCKET;
		return FALSE;
	}

	//
	//		設定發送超時時間
	//
	Result = setsockopt (icmpSocket, 
					     SOL_SOCKET, 
						 SO_SNDTIMEO, 
						 (char *)SendTimeout, 
						 sizeof(int));
	if (Result == SOCKET_ERROR)
	{
		icmpSocketError = WSAGetLastError();
		icmpSocketErrorMod = 3;
		closesocket (icmpSocket);
		icmpSocket = INVALID_SOCKET;
		return FALSE;
	}

	icmpCurSeq = 0;
	icmpCurId = (USHORT)GetCurrentProcessId();
	icmpHops = 0;

	return TRUE;

}

//////////////////////////////////////////////////////////////////////////////////
//																				//
//		CloseIcmpSocket																	//
//			Closes a socket associated with an Icmp object.						//
//																				//
//			Sets icmpSocketError and icmpSocketErrorMod to indicate the type	//
//			of error, and returns the integer result of the operation.			//
//																				//
//			icmpSocketError and icmpSocketErrorMod are preserved until the next	//
//			operation on this Icmp object is performed.							//
//																				//
//////////////////////////////////////////////////////////////////////////////////
int CIcmp::CloseIcmpSocket(void)
{

	if (icmpSocket == INVALID_SOCKET)
		return 0;
	int Result = closesocket(icmpSocket);
	if (Result == SOCKET_ERROR)
	{
		icmpSocketError = WSAGetLastError();
		icmpSocketErrorMod = 1;

		icmpSocket = INVALID_SOCKET;
	}
	return Result;

}

//////////////////////////////////////////////////////////////////////////////////
//																				//
//		SetAsynchNotification													//
//			Sets the window (process) to notify when a network event on the		//
//			socket associated with the Icmp object occurs.						//
//																				//
//			Requires the message number to send to the window, and the events	//
//			to notify on.														//
//																				//
//			Sets icmpSocketError and icmpSocketErrorMod to indicate the type	//
//			of error, and returns the integer result of the operation.			//
//																				//
//			icmpSocketError and icmpSocketErrorMod are preserved until the next	//
//			operation on this Icmp object is performed.							//
//																				//
//////////////////////////////////////////////////////////////////////////////////

//消息處理函數,當有網絡事件產生的時候
int CIcmp::SetAsynchNotification(HWND hWnd, unsigned int Message, long Events)
{
	//異步選擇事件的I/O方法
	int Result = WSAAsyncSelect (icmpSocket,
			 				     hWnd, 
								 Message, 
								 Events);
	if (Result == SOCKET_ERROR)
	{
		icmpSocketError = WSAGetLastError();
		icmpSocketErrorMod = 1;

		icmpSocket = INVALID_SOCKET;
	}
	return Result;
}

//////////////////////////////////////////////////////////////////////////////////
//																				//
//		SetTTL																	//
//			Set the TTL option on the socket associated with an Icmp object.	//
//			A TTL value of non-zero specifies the number of hops to query		//
//			before a response is returned.  By incrementing the TTL from 1 to	//
//			(number of hops to final destination), a TraceRoute function		//
//			can be performed.													//
//																				//
//			Sets icmpSocketError and icmpSocketErrorMod to indicate the type	//
//			of error, and returns the integer result of the operation.			//
//																				//
//			icmpSocketError and icmpSocketErrorMod are preserved until the next	//
//			operation on this Icmp object is performed.							//
//																				//
//////////////////////////////////////////////////////////////////////////////////

//設定TTL
int CIcmp::SetTTL(int TTL)
{

	int	Result;

	Result = setsockopt (icmpSocket, IPPROTO_IP, IP_TTL, (LPSTR)&TTL, sizeof(int));

	if (Result == SOCKET_ERROR)
	{
		icmpSocketErrorMod = 1;
		icmpSocketError = WSAGetLastError();
	}
	return Result;

}

//////////////////////////////////////////////////////////////////////////////////
//																				//
//		Ping																	//
//			Sends an ICMP ping message to the host indicated in the Icmp		//
//			variable icmpSockAddr.  The Icmp variables icmpCurSeq and			//
//			icmpCurId are sent in the buffer referenced by pIcmpBuffer.  The	//
//			referenced buffer must be large	enough to hold DataLen bytes plus	//
//			the size of the ICMP message header.								//

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
国产精品国模大尺度视频| 成人app在线| 亚洲人成在线观看一区二区| 欧美精品 日韩| 欧美亚洲综合久久| 91国偷自产一区二区三区成为亚洲经典 | 美女高潮久久久| 欧美国产综合一区二区| 精品少妇一区二区三区在线视频| 成人深夜在线观看| 福利一区福利二区| 国产成人精品免费网站| 国产高清不卡一区| 国产99精品视频| 成人午夜免费视频| 91丨porny丨蝌蚪视频| 91麻豆免费观看| 欧美日韩在线播| 欧美人动与zoxxxx乱| 91精品国产乱码| 精品成人私密视频| 久久综合av免费| 国产精品久久久久久久裸模 | 久久精品国产999大香线蕉| 日本特黄久久久高潮| 看片的网站亚洲| 懂色中文一区二区在线播放| 不卡高清视频专区| 欧美老女人第四色| 久久久久88色偷偷免费| 亚洲欧美电影一区二区| 午夜精品久久久久影视| 蜜桃视频第一区免费观看| 国产美女视频一区| 91免费看`日韩一区二区| 欧美视频一区在线| 欧美精品一区二区三区在线播放 | 岛国精品在线观看| 欧美做爰猛烈大尺度电影无法无天| 欧美性猛片xxxx免费看久爱| 欧美日本在线一区| 国产欧美日韩在线视频| 亚洲成人资源网| 国产成人免费av在线| 在线观看视频一区二区| 久久综合九色综合97_久久久| 亚洲精品一区二区三区福利 | 国产乱码精品一区二区三区av| 国产成人精品免费在线| 欧美日韩一区在线| 中文字幕乱码一区二区免费| 夜夜亚洲天天久久| 成人免费精品视频| 精品国产免费人成电影在线观看四季 | 性做久久久久久| 国产精品资源在线| 欧美日韩国产天堂| 国产精品久久久久三级| 人人狠狠综合久久亚洲| 色哟哟一区二区三区| 国产蜜臀av在线一区二区三区| 亚洲综合在线免费观看| 丁香婷婷综合色啪| 精品久久久久久久久久久院品网 | 欧美一区二区在线不卡| 亚洲同性同志一二三专区| 蜜臀av一区二区三区| 在线欧美日韩国产| 国产精品欧美久久久久无广告| 亚洲成av人片在www色猫咪| 成人av中文字幕| 国产视频911| 国内精品不卡在线| 精品国产乱码久久久久久老虎 | 色久综合一二码| 国产精品丝袜一区| 国产高清精品网站| 国产欧美一区视频| 黄色日韩三级电影| 精品国产一区二区在线观看| 日韩电影在线免费看| 欧美亚洲国产怡红院影院| 国产精品嫩草99a| 成人国产精品免费观看| 国产精品久久久久久久浪潮网站| 韩国成人在线视频| 国产亚洲欧美一区在线观看| 韩日欧美一区二区三区| 国产亚洲成aⅴ人片在线观看 | 91精品婷婷国产综合久久性色| 国产精品美女视频| 成人天堂资源www在线| 国产精品久久久久桃色tv| 成人动漫av在线| 中文字幕一区日韩精品欧美| 99精品视频在线免费观看| 亚洲色图制服诱惑| 欧美色区777第一页| 免费成人在线网站| 久久久精品人体av艺术| 粉嫩绯色av一区二区在线观看| 久久免费看少妇高潮| 成人激情小说网站| 亚洲欧美国产77777| 欧美日韩中文字幕一区二区| 免费高清在线一区| 日本一区二区三区dvd视频在线| 国内成+人亚洲+欧美+综合在线| 日韩视频一区二区三区| 国产精品影视在线观看| 一区二区三区电影在线播| 欧美一区二区性放荡片| 国产成人免费在线观看不卡| 亚洲最新在线观看| 精品久久久久久亚洲综合网| 成人久久久精品乱码一区二区三区| 久久久久国产精品人| 91小宝寻花一区二区三区| 婷婷综合另类小说色区| 国产精品剧情在线亚洲| 欧美日韩国产另类一区| 大尺度一区二区| 天堂一区二区在线免费观看| 欧美经典三级视频一区二区三区| 97久久超碰国产精品| 青娱乐精品视频在线| √…a在线天堂一区| 欧美一区二区三区免费观看视频| 国产精品18久久久久久久久| 亚洲国产综合人成综合网站| 久久精品人人做| 欧美精品1区2区3区| 91网站在线播放| 国产精品自在在线| 日本欧美在线观看| 亚洲一区二区综合| 亚洲美女在线一区| 中文字幕在线不卡国产视频| 日韩一区二区三| 欧美日韩免费一区二区三区| 大白屁股一区二区视频| 国产一区二区主播在线| 免费视频一区二区| 亚洲国产精品尤物yw在线观看| 久久久精品中文字幕麻豆发布| 欧美亚一区二区| 91丨国产丨九色丨pron| 成人h动漫精品一区二区| 国产在线一区二区| 激情久久久久久久久久久久久久久久| 久久久综合视频| 日韩欧美激情一区| 91精品国产手机| 3d成人动漫网站| 91精品国产乱码| 56国语精品自产拍在线观看| 在线一区二区三区四区| 日本高清无吗v一区| 日本乱人伦一区| 欧美性极品少妇| 欧美日本一区二区| 欧美高清视频一二三区| 日韩视频一区二区三区在线播放| 91久久国产最好的精华液| 91玉足脚交白嫩脚丫在线播放| 东方欧美亚洲色图在线| gogogo免费视频观看亚洲一| 成人精品免费看| 99精品久久免费看蜜臀剧情介绍| 国产成人精品一区二区三区四区| 免费xxxx性欧美18vr| 美女视频一区二区| 九色|91porny| 国产成人午夜片在线观看高清观看| 日本伊人色综合网| 狠狠狠色丁香婷婷综合久久五月| 日韩国产欧美在线视频| 久久精品国产精品亚洲综合| 国产在线视频一区二区三区| 福利一区福利二区| 欧美在线制服丝袜| 日韩欧美一级精品久久| 欧美激情一区二区三区| 亚洲欧美色图小说| 日本sm残虐另类| 国产成人在线电影| 色视频欧美一区二区三区| 欧美高清性hdvideosex| 精品日韩一区二区三区免费视频| 精品久久一区二区| 亚洲人成小说网站色在线| 午夜精品一区二区三区电影天堂| 青青草伊人久久| www.日韩av| 91精品国产综合久久久蜜臀图片| 精品免费视频.| 亚洲美女在线国产| 国产精品一区二区在线观看网站| av电影一区二区| 在线播放视频一区|