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

📄 idwinsock2.pas

📁 photo.163.com 相册下载器 多线程下载
💻 PAS
📖 第 1 页 / 共 5 页
字号:
  tf_disconnect      = $01;
  tf_reuse_socket    = $02;
  tf_write_behind    = $04;
  tf_use_default_worker = $00;
  tf_use_system_thread = $10;
  tf_use_kernel_apc   = $20;

// This is used instead of -1, since the TSocket type is unsigned.
  invalid_socket     = TSocket(not(0));
  socket_error       = -1;

//  The  following  may  be used in place of the address family, socket type, or
//  protocol  in  a  call  to WSASocket to indicate that the corresponding value
//  should  be taken from the supplied WSAPROTOCOL_INFO structure instead of the
//  parameter itself.
  from_protocol_info = -1;


// Types
  sock_stream     = 1;               { stream socket }
  sock_dgram      = 2;               { datagram socket }
  sock_raw        = 3;               { raw-protocol interface }
  sock_rdm        = 4;               { reliably-delivered message }
  sock_seqpacket  = 5;               { sequenced packet stream }

// option flags per-socket.
  so_debug            = $0001;            // turn on debugging info recording
  so_acceptconn       = $0002;            // socket has had listen()
  so_reuseaddr        = $0004;            // allow local address reuse
  so_keepalive        = $0008;            // keep connections alive
  so_dontroute        = $0010;            // just use interface addresses
  so_broadcast        = $0020;            // permit sending of broadcast msgs
  so_useloopback      = $0040;            // bypass hardware when possible
  so_linger           = $0080;            // linger on close if data present
  so_oobinline        = $0100;            // leave received OOB data in line

  so_dontlinger       = not SO_LINGER;
  so_exclusiveaddruse = not SO_REUSEADDR; // disallow local address reuse

// additional options.

  so_sndbuf           = $1001;      // send buffer size
  so_rcvbuf           = $1002;      // receive buffer size
  so_sndlowat         = $1003;      // send low-water mark
  so_rcvlowat         = $1004;      // receive low-water mark
  so_sndtimeo         = $1005;      // send timeout
  so_rcvtimeo         = $1006;      // receive timeout
  so_error            = $1007;      // get error status and clear
  so_type             = $1008;      // get socket type

// options for connect and disconnect data and options.
// used only by non-tcp/ip transports such as DECNet, OSI TP4, etc.
  so_conndata         = $7000;
  so_connopt          = $7001;
  so_discdata         = $7002;
  so_discopt          = $7003;
  so_conndatalen      = $7004;
  so_connoptlen       = $7005;
  so_discdatalen      = $7006;
  so_discoptlen       = $7007;

// option for opening sockets for synchronous access.
  so_opentype         = $7008;
  so_synchronous_alert    = $10;
  so_synchronous_nonalert = $20;

// other nt-specific options.
  so_maxdg                 = $7009;
  so_maxpathdg             = $700A;
  so_update_accept_context = $700B;
  so_connect_time          = $700C;

// tcp options.
  tcp_nodelay              = $0001;
  tcp_bsdurgent            = $7000;

// winsock 2 extension -- new options
  so_group_id              = $2001; // ID of a socket group
  so_group_priority        = $2002; // the relative priority within a group
  so_max_msg_size          = $2003; // maximum message size
  SO_Protocol_InfoA        = $2004; // WSAPROTOCOL_INFOA structure
  SO_Protocol_InfoW        = $2005; // WSAPROTOCOL_INFOW structure
{$IFDEF UNICODE}
  SO_Protocol_Info         = SO_Protocol_InfoW;
{$ELSE}
  SO_Protocol_Info         = SO_Protocol_InfoA;
{$ENDIF}
  pvd_config               = $3001; // configuration info for service provider
  so_conditional_accept    = $3002; // enable true conditional accept:
                                    // connection is not ack-ed to the
                                    // other side until conditional
                                    // function returns CF_ACCEPT

// Address families.
  af_unspec       = 0;               // unspecified
  af_unix         = 1;               // local to host (pipes, portals)
  af_inet         = 2;               // internetwork: UDP, TCP, etc.
  af_implink      = 3;               // arpanet imp addresses
  af_pup          = 4;               // pup protocols: e.g. BSP
  af_chaos        = 5;               // mit CHAOS protocols
  af_ipx          = 6;               // ipx and SPX
  af_ns           = af_ipx;          // xerOX NS protocols
  af_iso          = 7;               // iso protocols
  af_osi          = af_iso;          // osi is ISO
  af_ecma         = 8;               // european computer manufacturers
  af_datakit      = 9;               // datakit protocols
  af_ccitt        = 10;              // cciTT protocols, X.25 etc
  af_sna          = 11;              // ibm SNA
  af_decnet       = 12;              // decnet
  af_dli          = 13;              // direct data link interface
  af_lat          = 14;              // lat
  af_hylink       = 15;              // nsc Hyperchannel
  af_appletalk    = 16;              // appleTalk
  af_netbios      = 17;              // netBios-style addresses
  af_voiceview    = 18;              // voiceView
  af_firefox      = 19;              // fireFox
  af_unknown1     = 20;              // somebody is using this!
  af_ban          = 21;              // banyan
  af_atm          = 22;              // native ATM Services
  af_inet6        = 23;              // internetwork Version 6
  af_cluster      = 24;              // microsoft Wolfpack
  af_12844        = 25;              // ieeE 1284.4 WG AF
  af_irda         = 26;              // irdA
  af_netdes       = 28;              // network Designers OSI & gateway enabled protocols
  af_tcnprocess   = 29;
  af_tcnmessage   = 30;
  af_iclfxbm      = 31;

  af_max          = 32;


// protocol families, same as address families for now.

  pf_unspec       = af_unspec;
  pf_unix         = af_unix;
  pf_inet         = af_inet;
  pf_implink      = af_implink;
  pf_pup          = af_pup;
  pf_chaos        = af_chaos;
  pf_ns           = af_ns;
  pf_ipx          = af_ipx;
  pf_iso          = af_iso;
  pf_osi          = af_osi;
  pf_ecma         = af_ecma;
  pf_datakit      = af_datakit;
  pf_ccitt        = af_ccitt;
  pf_sna          = af_sna;
  pf_decnet       = af_decnet;
  pf_dli          = af_dli;
  pf_lat          = af_lat;
  pf_hylink       = af_hylink;
  pf_appletalk    = af_appletalk;
  pf_voiceview    = af_voiceview;
  pf_firefox      = af_firefox;
  pf_unknown1     = af_unknown1;
  pf_ban          = af_ban;
  pf_atm          = af_atm;
  pf_inet6        = af_inet6;

  pf_max          = af_max;

type

  SunB = packed record
    s_b1, s_b2, s_b3, s_b4: u_char;
  end;

  SunW = packed record
    s_w1, s_w2: u_short;
  end;

  TInAddr = packed record
    case integer of
      0: (S_un_b: SunB);
      1: (S_un_w: SunW);
      2: (S_addr: u_long);
  end;
  PInAddr = ^TInAddr;

  // Structure used by kernel to store most addresses.

  TSockAddrIn = packed record
    case Integer of
      0: (sin_family : u_short;
          sin_port   : u_short;
          sin_addr   : TInAddr;
          sin_zero   : array[0..7] of Char);
      1: (sa_family  : u_short;
          sa_data    : array[0..13] of Char)
  end;
  PSockAddrIn = ^TSockAddrIn;
  TSockAddr   = TSockAddrIn;
  PSockAddr   = ^TSockAddr;
  LPSOCKADDR  = PSockAddr;
  SOCKADDR    = TSockAddr;
  SOCKADDR_IN = TSockAddrIn;

  // Structure used by kernel to pass protocol information in raw sockets.
  PSockProto = ^TSockProto;
  TSockProto = packed record
    sp_family   : u_short;
    sp_protocol : u_short;
  end;

// Structure used for manipulating linger option.
  PLinger = ^TLinger;
  TLinger = packed record
    l_onoff: u_short;
    l_linger: u_short;
  end;

const
  inaddr_any       = $00000000;
  inaddr_loopback  = $7F000001;
  inaddr_broadcast = $FFFFFFFF;
  inaddr_none      = $FFFFFFFF;

  addr_any         = INADDR_ANY;

  sol_socket       = $ffff;          // options for socket level

  msg_oob          = $1;             // process out-of-band data
  msg_peek         = $2;             // peek at incoming message
  msg_dontroute    = $4;             // send without using routing tables

  msg_partial      = $8000;          // partial send or recv for message xport

// WinSock 2 extension -- new flags for WSASend(), WSASendTo(), WSARecv() and WSARecvFrom()
  msg_interrupt    = $10;    // send/recv in the interrupt context
  msg_maxiovlen    = 16;


// Define constant based on rfc883, used by gethostbyxxxx() calls.

  maxgethoststruct = 1024;

// Maximum queue length specifiable by listen.
  somaxconn        = $7fffffff;

// WinSock 2 extension -- bit values and indices for FD_XXX network events
  fd_read_bit                     = 0;
  fd_write_bit                    = 1;
  fd_oob_bit                      = 2;
  fd_accept_bit                   = 3;
  fd_connect_bit                  = 4;
  fd_close_bit                    = 5;
  fd_qos_bit                      = 6;
  fd_group_qos_bit                = 7;
  fd_routing_interface_change_bit = 8;
  fd_address_list_change_bit      = 9;

  fd_max_events    = 10;

  fd_read       = (1 shl fd_read_bit);
  fd_write      = (1 shl fd_write_bit);
  fd_oob        = (1 shl fd_oob_bit);
  fd_accept     = (1 shl fd_accept_bit);
  fd_connect    = (1 shl fd_connect_bit);
  fd_close      = (1 shl fd_close_bit);
  fd_qos        = (1 shl fd_qos_bit);
  fd_group_qos  = (1 shl fd_group_qos_bit);
  fd_routing_interface_change = (1 shl fd_routing_interface_change_bit);
  fd_address_list_change      = (1 shl fd_address_list_change_bit);

  fd_all_events = (1 shl fd_max_events) - 1;

// All Windows Sockets error constants are biased by WSABASEERR from the "normal"

  wsabaseerr              = 10000;

// Windows Sockets definitions of regular Microsoft C error constants

  wsaeintr                = wsabaseerr+  4;
  wsaebadf                = wsabaseerr+  9;
  wsaeacces               = wsabaseerr+ 13;
  wsaefault               = wsabaseerr+ 14;
  wsaeinval               = wsabaseerr+ 22;
  wsaemfile               = wsabaseerr+ 24;

// Windows Sockets definitions of regular Berkeley error constants

  wsaewouldblock          = wsabaseerr+ 35;
  wsaeinprogress          = wsabaseerr+ 36;
  wsaealready             = wsabaseerr+ 37;
  wsaenotsock             = wsabaseerr+ 38;
  wsaedestaddrreq         = wsabaseerr+ 39;
  wsaemsgsize             = wsabaseerr+ 40;
  wsaeprototype           = wsabaseerr+ 41;
  wsaenoprotoopt          = wsabaseerr+ 42;
  wsaeprotonosupport      = wsabaseerr+ 43;
  wsaesocktnosupport      = wsabaseerr+ 44;
  wsaeopnotsupp           = wsabaseerr+ 45;
  wsaepfnosupport         = wsabaseerr+ 46;
  wsaeafnosupport         = wsabaseerr+ 47;
  wsaeaddrinuse           = wsabaseerr+ 48;
  wsaeaddrnotavail        = wsabaseerr+ 49;
  wsaenetdown             = wsabaseerr+ 50;
  wsaenetunreach          = wsabaseerr+ 51;
  wsaenetreset            = wsabaseerr+ 52;
  wsaeconnaborted         = wsabaseerr+ 53;
  wsaeconnreset           = wsabaseerr+ 54;
  wsaenobufs              = wsabaseerr+ 55;
  wsaeisconn              = wsabaseerr+ 56;
  wsaenotconn             = wsabaseerr+ 57;
  wsaeshutdown            = wsabaseerr+ 58;
  wsaetoomanyrefs         = wsabaseerr+ 59;
  wsaetimedout            = wsabaseerr+ 60;
  wsaeconnrefused         = wsabaseerr+ 61;
  wsaeloop                = wsabaseerr+ 62;
  wsaenametoolong         = wsabaseerr+ 63;
  wsaehostdown            = wsabaseerr+ 64;
  wsaehostunreach         = wsabaseerr+ 65;
  wsaenotempty            = wsabaseerr+ 66;
  wsaeproclim             = wsabaseerr+ 67;
  wsaeusers               = wsabaseerr+ 68;
  wsaedquot               = wsabaseerr+ 69;
  wsaestale               = wsabaseerr+ 70;
  wsaeremote              = wsabaseerr+ 71;

// Extended Windows Sockets error constant definitions

  wsasysnotready          = wsabaseerr+ 91;
  wsavernotsupported      = wsabaseerr+ 92;
  wsanotinitialised       = wsabaseerr+ 93;

⌨️ 快捷键说明

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