⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 network_utility.h

📁 一个完成端口的框架程序
💻 H
字号:
//---------------------------------------------------------------------------

#ifndef NetWork_UtilityH
#define NetWork_UtilityH
//---------------------------------------------------------------------------
#include <winsock2.h>
#include <windows.h>
#include <stdio.h>
//---------------------------------------------------------------------------
/////////////////////////////////////
//     Socket helper functions     //
/////////////////////////////////////
//Test AHost is a Valid IP Address String
bool __fastcall IsIP(const char *AHost);
//Resolvehost from AHost to IP Address stored to DestIP String
bool __fastcall GetHostByName(const char AHost[],char *DestIP);
//Resolvehost from AHost to IP Address stored to DestIP String
//test It is Local Address
bool __fastcall ResolveHost(const char AHost[],char *DestIP);
//imitate a client role connection to the serverAddress:Port,
//force the server's listen socket return from accept-blocking
void __fastcall TempConnect(const char BindAddress[],const int Port);
void __fastcall ForceCloseSocket(SOCKET &s,bool bClose=false);
//---------------------------------------------------------------------------
///////////////////////////////////////////////////
//    I/O Completion Port Operation functions    //
///////////////////////////////////////////////////
/*Create new I/O Completion Port*/
//
//[in]dwNumberOfConcurrentThreads:
// Maximum number of threads
// that the operating system can allow
// to concurrently process I/O completion packets
// for the I/O completion port.
//
//Return Value:a new I/O Completion Port Handle
HANDLE CreateNewIoCompletionPort(DWORD dwNumberOfConcurrentThreads);
/*Associate Device(socket) with I/O Completion Port*/
//[in] hComPort:
//Handle to I/O Completion Port
bool AssociateWithIoCompletionPort(HANDLE hComPort,HANDLE hDevice,DWORD dwCompKey);
//---------------------------------------------------------------------------
#endif

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -