network_utility.h

来自「一个完成端口的框架程序」· C头文件 代码 · 共 44 行

H
44
字号
//---------------------------------------------------------------------------

#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 + =
减小字号Ctrl + -
显示快捷键?