<commit_before>(*
 *	 Unit owner: d10.
 *	       blog: http://www.cnblogs.com/dksoft
 *     homePage: www.diocp.org
 *
 *   2015-02-22 08:29:43
 *     DIOCP-V5 
 *
 *)
 
unit diocp.sockets.utils;

interface

uses
  Windows, SysUtils, diocp.winapi.winsock2;

// 25:XE5
{$IF CompilerVersion<=25}
type
     NativeUInt = Cardinal;
     IntPtr = Cardinal;
{$ifend}

// XE2 = 22
{$if CompilerVersion < 23}
   ULONG_PTR = Cardinal;
{$else}
   ULONG_PTR = NativeUInt;
{$ifend}

type
  TSocketState = (ssDisconnected, ssConnected, ssConnecting, ssListening, ssAccepting);

  TIocpAcceptEx = function(sListenSocket, sAcceptSocket: TSocket; lpOutputBuffer:
      Pointer; dwReceiveDataLength, dwLocalAddressLength, dwRemoteAddressLength:
      DWORD; var lpdwBytesReceived: DWORD; lpOverlapped: POverlapped): BOOL; stdcall;

  TIocpConnectEx = function(const s : TSocket; const name: PSOCKADDR; const
      namelen: Integer; lpSendBuffer : Pointer; dwSendDataLength : DWORD; var
      lpdwBytesSent : DWORD; lpOverlapped : LPWSAOVERLAPPED): BOOL; stdcall;


  //  Extention function "GetAcceptExSockAddrs"
  TIocpGetAcceptExSockAddrs = procedure(lpOutputBuffer: Pointer;
      dwReceiveDataLength, dwLocalAddressLength, dwRemoteAddressLength: DWORD;
      var LocalSockaddr: PSockAddr; var LocalSockaddrLength: Integer;
      var RemoteSockaddr: PSockAddr; var RemoteSockaddrLength: Integer); stdcall;<commit_msg>* 修复编译问题(XE3以上）<commit_after>(*
 *	 Unit owner: d10.
 *	       blog: http://www.cnblogs.com/dksoft
 *     homePage: www.diocp.org
 *
 *   2015-02-22 08:29:43
 *     DIOCP-V5 
 *
 *)
 
unit diocp.sockets.utils;

interface

uses
  Windows, SysUtils, diocp.winapi.winsock2;

type
// 25:XE5
{$IF CompilerVersion<=25}
     NativeUInt = Cardinal;
     IntPtr = Cardinal;
{$ifend}

// XE2 = 22
{$if CompilerVersion < 23}
   ULONG_PTR = Cardinal;
{$else}
   ULONG_PTR = NativeUInt;
{$ifend}

type
  TSocketState = (ssDisconnected, ssConnected, ssConnecting, ssListening, ssAccepting);

  TIocpAcceptEx = function(sListenSocket, sAcceptSocket: TSocket; lpOutputBuffer:
      Pointer; dwReceiveDataLength, dwLocalAddressLength, dwRemoteAddressLength:
      DWORD; var lpdwBytesReceived: DWORD; lpOverlapped: POverlapped): BOOL; stdcall;

  TIocpConnectEx = function(const s : TSocket; const name: PSOCKADDR; const
      namelen: Integer; lpSendBuffer : Pointer; dwSendDataLength : DWORD; var
      lpdwBytesSent : DWORD; lpOverlapped : LPWSAOVERLAPPED): BOOL; stdcall;


  //  Extention function "GetAcceptExSockAddrs"
  TIocpGetAcceptExSockAddrs = procedure(lpOutputBuffer: Pointer;
      dwReceiveDataLength, dwLocalAddressLength, dwRemoteAddressLength: DWORD;
      var LocalSockaddr: PSockAddr; var LocalSockaddrLength: Integer;
      var RemoteSockaddr: PSockAddr; var RemoteSockaddrLength: Integer); stdcall;
{'fraction_non_alphanumeric': 0.09942979330007128, 'fraction_numerical': 0.020313613684960798, 'mean_word_length': 4.356870229007634, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 4, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '7196496', 'n_tokens_mistral': 1045, 'n_tokens_neox': 952, 'n_words': 212}