Attribute VB_Name = "modWINSOCK" Option Explicit '============================================================================================================= ' ' modWINSOCK Module ' ----------------- ' ' Created By : Kevin Wilson ' http://www.TheVBZone.com ( The VB Zone ) ' http://www.TheVBZone.net ( The VB Zone .net ) ' ' Last Update : February 27, 2001 ' ' VB Versions : 5.0 / 6.0 ' ' Requires : At least Winsock version 1.1 or an operating system that comes with at least Winsock v1.1. ' Some Winsock APIs require that Winsock 2.0 be installed. See below for details. ' ' Description : This module gives you full access to all the documented functions of the WSOCK32.DLL and ' WS2_32.DLL and all of the types (structures) and constants that are required to make use ' of those functions. ' ' See Also: ' --------- ' http://msdn.microsoft.com/library/default.asp?URL=/library/psdk/winsock/ovrvw3_1436.htm ' http://msdn.microsoft.com/library/default.asp?URL=/library/psdk/winsock/ovrvw3_8vaq.htm ' http://www.stardust.com/winsock/ws_src.htm ' http://www.sockets.com/ ' http://www.vbip.com/default.asp ' '============================================================================================================= ' ' LEGAL: ' ' You are free to use this code as long as you keep the above heading information intact and unchanged. Credit ' given where credit is due. Also, it is not required, but it would be appreciated if you would mention ' somewhere in your compiled program that that your program makes use of code written and distributed by ' Kevin Wilson (www.TheVBZone.com). Feel free to link to this code via your web site or articles. ' ' You may NOT take this code and pass it off as your own. You may NOT distribute this code on your own server ' or web site. You may NOT take code created by Kevin Wilson (www.TheVBZone.com) and use it to create products, ' utilities, or applications that directly compete with products, utilities, and applications created by Kevin ' Wilson, TheVBZone.com, or Wilson Media. You may NOT take this code and sell it for profit without first ' obtaining the written consent of the author Kevin Wilson. ' ' These conditions are subject to change at the discretion of the owner Kevin Wilson at any time without ' warning or notice. Copyrightİ by Kevin Wilson. All rights reserved. ' '============================================================================================================= '_____________________________________________________________________________________________________________ 'ŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻ ' The following table is an alphabetical list of the functions provided by the Windows Sockets API. 'ŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻ ' accept ' AcceptEx ' bind ' closesocket ' Connect ' EnumProtocols ' GetAcceptExSockaddrs ' GetAddressByName ' gethostbyaddr ' gethostbyname ' gethostname ' GetNameByType ' getpeername ' getprotobyname ' getprotobynumber ' getservbyname ' getservbyport ' GetService ' getsockname ' getsockopt ' GetTypeByName ' htonl ' htons ' inet_addr ' inet_ntoa ' ioctlsocket ' listen ' ntohl ' ntohs ' recv ' recvfrom ' select ' send ' sendto ' SetService ' setsockopt ' shutdown ' socket ' TransmitFile ' WSAAccept ' WSAAddressToString ' WSAAsyncGetHostByAddr ' WSAAsyncGetHostByName ' WSAAsyncGetProtoByName ' WSAAsyncGetProtoByNumber ' WSAAsyncGetServByName ' WSAAsyncGetServByPort ' WSAAsyncSelect ' WSACancelAsyncRequest ' WSACancelBlockingCall ' WSACleanup ' WSACloseEvent ' WSAConnect ' WSACreateEvent ' WSADuplicateSocket ' WSAEnumNameSpaceProviders ' WSAEnumNetworkEvents ' WSAEnumProtocols ' WSAEventSelect ' WSAGetLastError ' WSAGetOverlappedResult ' WSAGetQOSByName ' WSAGetServiceClassInfo ' WSAGetServiceClassNameByClassId ' WSAHtonl ' WSAHtons ' WSAInstallServiceClass ' WSAIoctl ' WSAIsBlocking ' WSAJoinLeaf ' WSALookupServiceBegin ' WSALookupServiceEnd ' WSALookupServiceNext ' WSANtohl ' WSANtohs ' WSAProviderConfigChange ' WSARecv ' WSARecvDisconnect ' WSARecvEx ' WSARecvFrom ' WSARemoveServiceClass ' WSAResetEvent ' WSASend ' WSASendDisconnect ' WSASendTo ' WSASetBlockingHook ' WSASetEvent ' WSASetLastError ' WSASetService ' WSASocket ' WSAStartup ' WSAStringToAddress ' WSAUnhookBlockingHook ' WSAWaitForMultipleEvents '_____________________________________________________________________________________________________________ 'ŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻ '_____________________________________________________________________________________________________________ 'ŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻ ' The following functions are only available if you have Windows Sockets version 1.1 or greater installed on ' your computer, or if your operating system comes with at least Winsock 1.1 pre-installed: 'ŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻ ' accept ' AcceptEx - Not Supported On Windows 95 or Windows 98 ' bind ' closesocket ' connect ' EnumProtocols - Obsolete in Winsock 2.0 ' GetAcceptExSockaddrs ' GetAddressByName - Obsolete in Winsock 2.0 ' gethostbyaddr ' gethostbyname ' gethostname ' GetNameByType - Obsolete in Winsock 2.0 ' getpeername ' getprotobyname ' getprotobynumber ' getservbyname ' getservbyport ' GetService - Obsolete in Winsock 2.0 ' getsockname - Not Supported On Windows 95 ' getsockopt ' GetTypeByName - Obsolete in Winsock 2.0 ' htonl ' htons ' inet_addr ' inet_ntoa ' ioctlsocket ' listen ' ntohl ' ntohs ' recv ' recvfrom ' send ' sendto ' SetService - Obsolete in Winsock 2.0 / Not Supported On Windows 95 ' setsockopt ' shutdown ' socket ' TransmitFile - Not Supported On Windows 95 ' WSAAsyncGetHostByAddr ' WSAAsyncGetHostByName ' WSAAsyncGetProtoByName ' WSAAsyncGetProtoByNumber ' WSAAsyncGetServByName ' WSAAsyncGetServByPort ' WSAAsyncSelect ' WSACancelAsyncRequest ' WSACancelBlockingCall - Obsolete in Winsock 2.0 ' WSACleanup ' WSACloseEvent ' WSAGetLastError ' WSAIsBlocking - Obsolete in Winsock 2.0 ' WSARecvEx - Not Supported On Windows 95 ' WSASetBlockingHook - Obsolete in Winsock 2.0 ' WSASetLastError ' WSAStartup ' WSAUnhookBlockingHook - Obsolete in Winsock 2.0 ' '_____________________________________________________________________________________________________________ ' The following functions are only available if you have Windows Sockets version 2.0 or greater installed on ' your computer, or if your operating system comes with at least Winsock 2.0 pre-installed: ' ' NOTE : Some of these functions can be found in the WSOCK32.DLL (Windows Sockets v1.1) ' ' NOTE : All of the Winsock 1.1 APIs are supported in Winsock 2.0 for backwards compatibility 'ŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻ ' select ' WSAAccept ' WSAAddressToString ' WSAConnect ' WSACreateEvent ' WSADuplicateSocket ' WSAEnumNameSpaceProviders ' WSAEnumNetworkEvents ' WSAEnumProtocols ' WSAEventSelect ' WSAGetOverlappedResult ' WSAGetQOSByName ' WSAGetServiceClassInfo ' WSAGetServiceClassNameByClassId ' WSAHtonl ' WSAHtons ' WSAInstallServiceClass ' WSAIoctl ' WSAJoinLeaf ' WSALookupServiceBegin ' WSALookupServiceEnd ' WSALookupServiceNext ' WSANtohl ' WSANtohs ' WSAProviderConfigChange ' WSARecv ' WSARecvDisconnect ' WSARecvFrom ' WSARemoveServiceClass ' WSAResetEvent ' WSASend ' WSASendDisconnect ' WSASendTo ' WSASetEvent ' WSASetService ' WSASocket ' WSAStringToAddress ' WSAWaitForMultipleEvents '_____________________________________________________________________________________________________________ 'ŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻ 'XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX 'XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX 'XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX 'XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX 'XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX 'XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX 'XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX 'XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX 'XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX 'XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX 'XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX 'XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX 'XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX 'XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX 'XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX 'XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX 'XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX 'XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX 'XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX 'XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX 'XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX 'XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX 'XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX 'XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX '------------------------------------------------------------------------------------------------------------- ' The following are type definitions that are necisary to understand because when making the transfer from ' C (Win32 API) to Visual Basic, you need to know the data type's size in bytes to match it up with the ' correct corisponding VB data type. '------------------------------------------------------------------------------------------------------------- ' typedef UINT_PTR SOCKET; ' #define WSAEVENT HANDLE '------------------------------------------------------------------------------------------------------------- ' Type Declarations Public Type GUID 'The GUID data type is a text string representing a Class identifier(ID). COM must be able to convert the string to a valid Class ID. All GUIDs must be authored in uppercase. The valid format for a GUID is {XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX} where X is a hex digit (0,1,2,3,4,5,6,7,8,9,A,B,C,D,E,F). Data1 As Long Data2 As Integer Data3 As Integer Data4(8) As Byte End Type Public Type BLOB 'Requires Windows Sockets 1.1 or later (Not supported on Windows 95) cbSize As Long 'ULONG // Size of the block of data pointed to by pBlobData, in bytes. pBlobData As Byte 'BYTE * // Pointer to a block of data. End Type Public Type HOSTENT 'Requires Windows Sockets 2.0 hName As Long ' char FAR * - Official name of the host (PC). If using the DNS or similar resolution system, it is the Fully Qualified Domain Name (FQDN) that caused the server to return a reply. If using a local hosts file, it is the first entry after the IP address. hAliases As Long ' char FAR * FAR * - NULL terminated array of alternate names. hAddrType As Integer ' short - Type of address being returned. hLength As Integer ' short - Length of each address, in bytes. hAddrList As Long ' char FAR * FAR * - NULL terminated list of addresses for the host. Addresses are returned in network byte order. The macro h_addr is defined to be h_addr_list[0] for compatibility with older software. End Type Public Type IN_ADDR 'Requires Windows Sockets 2.0 s_b(3) As Byte 'struct {u_char s_b1,s_b2,s_b3,s_b4;} // Address of the host formatted as four u_chars s_w(1) As Integer 'struct {u_short s_w1,s_w2;} // Address of the host formatted as two u_shorts S_addr As Long 'u_long // Address of the host formatted as a u_long End Type ' NOTE: Whenver a function calls for a "IN_ADDR" structure, use LONG instead and pass the results of inet_addr("xxx.xxx.xxx.xxx") ' #define s_addr S_un.S_addr // Can be used for most tcp & ip code ' #define s_host S_un.S_un_b.s_b2 // Host on imp ' #define s_net S_un.S_un_b.s_b1 // Network ' #define s_imp S_un.S_un_w.s_w2 // Imp ' #define s_impno S_un.S_un_b.s_b4 // Imp # ' #define s_lh S_un.S_un_b.s_b3 // Logical host Public Type PROTOENT 'Requires Windows Sockets 2.0 p_name As Long 'char FAR * // Official name of the protocol p_aliases As Long 'char FAR * FAR * // Null-terminated array of alternate names p_proto As Integer 'short // Protocol number, in host byte order End Type Public Type PROTOCOL_INFO 'Requires Windows Sockets 1.1 or later dwServiceFlags As Long ' DWORD // A set of bit flags that specifies the services provided by the protocol. One or more of the XP_* bit flags may be set. iAddressFamily As Long ' INT // Value to pass as the af parameter when the socket function is called to open a socket for the protocol. This address family value uniquely defines the structure of protocol addresses, also known as sockaddr structures, used by the protocol. iMaxSockAddr As Long ' INT // Maximum length of a socket address supported by the protocol. iMinSockAddr As Long ' INT // Minimum length of a socket address supported by the protocol. iSocketType As Long ' INT // Value to pass as the type parameter when the socket function is called to open a socket for the protocol. Note that if XP_PSEUDO_STREAM is set in dwServiceFlags, the application can specify SOCK_STREAM as the type parameter to socket, regardless of the value of iSocketType. iProtocol As Long ' INT // Value to pass as the protocol parameter when the socket function is called to open a socket for the protocol. dwMessageSize As Long ' DWORD // Maximum message size supported by the protocol. This is the maximum size of a message that can be sent from or received by the host. For protocols that do not support message framing, the actual maximum size of a message that can be sent to a given address may be less than this value. The following special message size values are defined: ' &H0 = The protocol is stream-oriented; the concept of message size is not relevant. ' &HFFFFFFFF = The protocol is message-oriented, but there is no maximum message size. lpProtocol As String ' LPTSTR // Points to a zero-terminated string that supplies a name for the protocol; for example, "SPX2" End Type Public Type SERVENT 'Requires Windows Sockets 2.0 s_name As Long 'char FAR * // Official name of the service. s_aliases As Long 'char FAR * FAR * // Null-terminated array of alternate names. s_port As Integer 'short // Port number at which the service can be contacted. Port numbers are returned in network byte order. s_proto As Long 'char FAR * // Name of the protocol to use when contacting the service. End Type Public Type SERVICE_ADDRESS 'Requires Windows Sockets 2.0 dwAddressType As Long 'DWORD // Address family to which the socket address pointed to by lpAddress belongs. dwAddressFlags As Long 'DWORD // Set of bit flags that specify properties of the address. The following bit flags are defined: SERVICE_ADDRESS_FLAG_RPC_CN, SERVICE_ADDRESS_FLAG_RPC_DG, SERVICE_ADDRESS_FLAG_RPC_NB dwAddressLength As Long 'DWORD // Size, in bytes, of the address. Reserved1 As Long 'DWORD // Reserved for future use. Must be zero. lpAddress As Byte 'BYTE * // Pointer to a socket address of the appropriate type. Reserved2 As Byte 'BYTE * // Reserved for future use. It must be null. End Type Public Type SOCKADDR 'Requires Windows Sockets 2.0 (This structure is used with TCP/IP) sin_family As Integer 'short sin_port As Integer 'u_short sin_addr As Long 'struct IN_ADDR sin_zero As String * 7 'char[8] End Type Public Type SOCKADDR1 'Requires Windows Sockets 2.0 (This is the more generic version of the structure) sa_Family As Integer 'u_short sa_Data As String * 13 'char[14] End Type Public Type SOCKET_ADDRESS 'Requires Windows Sockets 2.0 lpSockaddr As SOCKADDR 'LPSOCKADDR // Pointer to a socket address iSockaddrLength As Long 'INT // Length of the socket address, in bytes. End Type Public Type SERVICE_ADDRESSES dwAddressCount As Long 'DWORD // Specifies the number of SERVICE_ADDRESS structures in the Addresses array. Addresses() As SERVICE_ADDRESS 'SERVICE_ADDRESS[1] // An array of SERVICE_ADDRESS data structures. Each SERVICE_ADDRESS structure contains information about a network service address. End Type Public Type CSADDR_INFO 'Requires Windows Sockets 1.1 or later. LocalAddr As SOCKET_ADDRESS 'SOCKET_ADDRESS // Specifies a Windows Sockets local address. In a client application, pass this address to the bind function to obtain access to a network service. In a network service, pass this address to the bind function so that the service is bound to the appropriate local address. RemoteAddr As SOCKET_ADDRESS 'SOCKET_ADDRESS // Specifies a Windows Sockets remote address. There are several uses for this remote address: 1) You can use this remote address to connect to the service through the connect function. This is useful if an application performs send/receive operations that involve connection-oriented protocols. 2) You can use this remote address with the sendto function when you are communicating over a connectionless (datagram) protocol. If you are using a connectionless protocol, such as UDP, sendto is typically the way you pass data iSocketType As Long 'INT // Specifies the type of the Windows socket. The following socket types are defined in Winsock.h: SOCK_STREAM, SOCK_DGRAM, SOCK_RDM, SOCK_SEQPACKET iProtocol As Long 'INT // Specifies a value to pass as the protocol parameter to the socket function to open a socket for this service. End Type Public Type SERVICE_INFO ' Requires Windows Sockets 1.1 or later (Not supported on Windows 95) lpServiceType As GUID 'LPGUID // Pointer to a GUID that is the type of the network service. lpServiceName As Long 'LPTSTR // Pointer to a zero-terminated string that is the name of the network service. If you are calling the SetService function with the dwNameSpace parameter set to NS_DEFAULT, the network service name must be a common name. A common name is what the network service is commonly known as. An example of a common name for a network service is "My SQL Server". If you are calling the SetService function with the dwNameSpace parameter set to a specific service name, the network service name can be a common name or a distinguished name. A distinguished name distinguishes the service to a unique location with a directory service. An example of a distinguished name for a network service is "MS\\SYS\\NT\\DEV\\My SQL Server". lpComment As String 'LPTSTR // Pointer to a zero-terminated string that is a comment or description for the network service. For example, "Used for development upgrades." lpLocale As String 'LPTSTR // Pointer to a zero-terminated string that contains locale information. dwDisplayHint As Long 'DWORD // Specifies a hint as to how to display the network service in a network browsing user interface. This can be one of the RESOURCEDISPLAYTYPE_* following values. dwVersion As Long 'DWORD // Version information for the network service. The high word of this value specifies a major version number. The low word of this value specifies a minor version number. Reserved As Long 'DWORD // Reserved for future use. Must be set to zero. lpMachineName As String 'LPTSTR // Pointer to a zero-terminated string that is the name of the computer on which the network service is running. lpServiceAddress As SERVICE_ADDRESSES 'LPSERVICE_ADDRESSES // Pointer to a SERVICE_ADDRESSES structure that contains an array of SERVICE_ADDRESS structures. Each SERVICE_ADDRESS structure contains information about a network service address. ServiceSpecificInfo As BLOB 'BLOB // A BLOB structure that specifies service-defined information. Note that In general, the data pointed to by the BLOB structure's pBlobData member must not contain any pointers. That is because only the network service knows the format of the data; copying the data without such knowledge would lead to pointer invalidation. If the data pointed to by pBlobData contains variable-sized elements, offsets from pBlobData can be used to indicate the location of those elements. There is one exception to this general rule: when pBlobData points to a SERVICE_TYPE_INFO_ABS structure. This is possible because both the SERVICE_TYPE_INFO_ABS structure, and any SERVICE_TYPE_VALUE_ABS structures it contains are predefined, and thus their formats are known to the operating system. End Type Public Type NS_SERVICE_INFO 'Requires Windows Sockets 1.1 or later (Not supported on Windows 95) dwNameSpace As Long 'DWORD // Specifies the name space or a set of default name spaces to which this service information applies. Use one of the following constant values to specify a name space: NS_DEFAULT, NS_DNS, NS_MS, NS_NDS, NS_NETBT, NS_NIS, NS_SAP, NS_STDA, NS_TCPIP_HOSTS, NS_TCPIP_LOCAL, NS_WINS, NS_X500 ServiceInfo As SERVICE_INFO 'SERVICE_INFO // A SERVICE_INFO structure that contains information about a network service or network service type. End Type Public Type FD_SET ' Requires Windows Sockets 2.0 fd_count As Long 'u_int // How many are SET? fd_array(63) As Long 'SOCKET [FD_SETSIZE] // An array of SOCKETs End Type Public Type TIMEVAL ' Requires Windows Sockets 2.0 tv_sec As Long 'long // Seconds tv_usec As Long 'long // Microseconds End Type Public Type OVERLAPPED Internal As Long 'ULONG_PTR // Reserved for operating system use. This member, which specifies a system-dependent status, is valid when the GetOverlappedResult function returns without setting the extended error information to ERROR_IO_PENDING. InternalHigh As Long 'ULONG_PTR // Reserved for operating system use. This member, which specifies the length of the data transferred, is valid when the GetOverlappedResult function returns TRUE. Offset As Long 'DWORD // Specifies a file position at which to start the transfer. The file position is a byte offset from the start of the file. The calling process sets this member before calling the ReadFile or WriteFile function. This member is ignored when reading from or writing to named pipes and communications devices and should be zero. OffsetHigh As Long 'DWORD // Specifies the high word of the byte offset at which to start the transfer. This member is ignored when reading from or writing to named pipes and communications devices and should be zero. hEvent As Long 'HANDLE // Handle to an event set to the signaled state when the operation has been completed. The calling process must set this member either to zero or a valid event handle before calling any overlapped functions. To create an event object, use the CreateEvent function. End Type Public Type WSAOVERLAPPED 'Requires Windows Sockets 2.0 Internal As Long 'DWORD // Reserved for internal use. The Internal member is used internally by the entity that implements overlapped I/O. For service providers that create sockets as installable file system (IFS) handles, this parameter is used by the underlying operating system. Other service providers (non-IFS providers) are free to use this parameter as necessary. InternalHigh As Long 'DWORD // Reserved. Used internally by the entity that implements overlapped I/O. For service providers that create sockets as IFS handles, this parameter is used by the underlying operating system. NonIFS providers are free to use this parameter as necessary. Offset As Long 'DWORD // Reserved for use by service providers. OffsetHigh As Long 'DWORD // Reserved for use by service providers. hEvent As Long 'WSEVENT // If an overlapped I/O operation is issued without an I/O completion routine (lpCompletionRoutine is null), then this parameter should either contain a valid handle to a WSAEVENT object or be null. If lpCompletionRoutine is non-null then applications are free to use this parameter as necessary. End Type Public Type TRANSMIT_FILE_BUFFERS ' Requires Windows Sockets 1.1 or later (Not supported on Windows 95) Head As Long 'PVOID // Pointer to a buffer that contains data to be transmitted before the file data is transmitted. HeadLength As Long 'DWORD // Number of bytes in the buffer pointed to by Head that are to be transmitted. Tail As Long 'PVOID // Pointer to a buffer that contains data to be transmitted after the file data is transmitted. TailLength As Long 'DWORD // Number of bytes of data in the buffer pointed to by the Tail member that are to be transmitted. End Type Public Type FLOWSPEC ' Flow Specifications for each direction of data flow. TokenRate As Long 'uint32 // In Bytes/sec TokenBucketSize As Long 'uint32 // In Bytes PeakBandwidth As Long 'uint32 // In Bytes/sec Latency As Long 'uint32 // In microseconds DelayVariation As Long 'uint32 // In microseconds ServiceType As Long 'ServiceType (uint32) MaxSduSize As Long 'uint32 // In Bytes MinimumPolicedSize As Long 'uint32 // In Bytes End Type Public Type WSABUF 'Requires Windows Sockets 2.0 len As Long 'u_long // The length of the buffer buf As Long 'char FAR * // The pointer to the buffer End Type Public Type QOS ' QualityOfService SendingFlowspec As FLOWSPEC 'FLOWSPEC // The flow spec for data sending ReceivingFlowspec As FLOWSPEC 'FLOWSPEC // The flow spec for data receiving */ ProviderSpecific As WSABUF 'WSABUF // Additional provider specific stuff */ End Type Public Type WSAPROTOCOLCHAIN 'Requires Windows Sockets 2.0 ChainLen As Long 'int // Length of the chain. The following settings apply: Setting ChainLen to zero indicates a layered protocol, Setting ChainLen to one indicates a base protocol, Setting ChainLen to greater than one indicates a protocol chain ChainEntries(6) As Long 'DWORD [MAX_PROTOCOL_CHAIN] // Array of protocol chain entries. End Type Public Type WSAPROTOCOL_INFO 'Requires Windows Sockets 2.0 dwServiceFlags1 As Long 'DWORD // Bitmask describing the services provided by the protocol. The following values are possible: XP1_CONNECTIONLESS, XP1_GUARANTEED_DELIVERY, XP1_GUARANTEED_ORDER, XP1_MESSAGE_ORIENTED, XP1_PSEUDO_STREAM, XP1_GRACEFUL_CLOSE, XP1_EXPEDITED_DATA, XP1_CONNECT_DATA, XP1_DISCONNECT_DATA, XP1_INTERRUPT, XP1_SUPPORT_BROADCAST, XP1_SUPPORT_MULTIPOINT, XP1_MULTIPOINT_CONTROL_PLANE, XP1_MULTIPOINT_DATA_PLANE, XP1_QOS_SUPPORTED, XP1_UNI_SEND, XP1_UNI_RECV, XP1_IFS_HANDLES, XP1_PARTIAL_MESSAGE ' Note that only one of XP1_UNI_SEND or XP1_UNI_RECV may be set. If a protocol can be unidirectional in either direction, two WSAPROTOCOL_INFOW structures should be used. When neither bit is set, the protocol is considered to be bidirectional. dwServiceFlags2 As Long 'DWORD // Reserved for additional protocol-attribute definitions. dwServiceFlags3 As Long 'DWORD // Reserved for additional protocol-attribute definitions. dwServiceFlags4 As Long 'DWORD // Reserved for additional protocol-attribute definitions. dwProviderFlags As Long 'DWORD // Provides information about how this protocol is represented in the protocol catalog. The following flag values are possible: PFL_MULTIPLE_PROTO_ENTRIES, PFL_RECOMMENDED_PROTO_ENTRY, PFL_HIDDEN, PFL_MATCHES_PROTOCOL_ZERO ProviderId As GUID 'GUID // Globally unique identifier assigned to the provider by the service provider vendor. This value is useful for instances where more than one service provider is able to implement a particular protocol. An application may use the dwProviderId value to distinguish between providers that might otherwise be indistinguishable. dwCatalogEntryId As Long 'DWORD // Unique identifier assigned by the WS2_32.DLL for each WSAPROTOCOL_INFOW structure. ProtocolChain As WSAPROTOCOLCHAIN 'WSAPROTOCOLCHAIN // If the length of the chain is 0, this WSAPROTOCOL_INFOW entry represents a layered protocol which has Windows Sockets 2 SPI as both its top and bottom edges. If the length of the chain equals 1, this entry represents a base protocol whose Catalog Entry identifier is in the dwCatalogEntryId member of the WSAPROTOCOL_INFOW structure. If the length of the chain is larger than 1, this entry represents a protocol chain which consists of one or more layered protocols on top of a base protocol. The corresponding Catalog Entry identifiers are in the ProtocolChain.ChainEntries array starting with the layered protocol at the top (the zero element in the ProtocolChain.ChainEntries array) and ending with the base protocol. Refer to the Windows Sockets 2 Service Provider Interface specification for more information on protocol chains. iVersion As Long 'int // Protocol version identifier. iAddressFamily As Long 'int // Value to pass as the address family parameter to the socket/WSASocket function in order to open a socket for this protocol. This value also uniquely defines the structure of protocol addresses SOCKADDRs used by the protocol. iMaxSockAddr As Long 'int // Maximum address length. iMinSockAddr As Long 'int // Minimum address length. iSocketType As Long 'int // Value to pass as the socket type parameter to the socket function in order to open a socket for this protocol. iProtocol As Long 'int // Value to pass as the protocol parameter to the socket function in order to open a socket for this protocol. iProtocolMaxOffset As Long 'int // Maximum value that may be added to iProtocol when supplying a value for the protocol parameter to socket and WSASocket. Not all protocols allow a range of values. When this is the case iProtocolMaxOffset is zero. iNetworkByteOrder As Long 'int // Currently these values are manifest constants (BIGENDIAN and LITTLEENDIAN) that indicate either big-endian or little-endian with the values 0 and 1 respectively. iSecurityScheme As Long 'int // Indicates the type of security scheme employed (if any). A value of SECURITY_PROTOCOL_NONE is used for protocols that do not incorporate security provisions. dwMessageSize As Long 'DWORD // Maximum message size supported by the protocol. This is the maximum size that can be sent from any of the host's local interfaces. For protocols that do not support message framing, the actual maximum that can be sent to a given address may be less. There is no standard provision to determine the maximum inbound message size. The following special values are defined: ' 0 = The protocol is stream-oriented and hence the concept of message size is not relevant. ' &H1 = The maximum outbound (send) message size is dependent on the underlying network MTU (maximum sized transmission unit) and hence cannot be known until after a socket is bound. Applications should use getsockopt to retrieve the value of SO_MAX_MSG_SIZE after the socket has been bound to a local address. ' &HFFFFFFFF = The protocol is message-oriented, but there is no maximum limit to the size of messages that may be transmitted. dwProviderReserved As Long 'DWORD // Reserved for use by service providers. szProtocol As String * 255 'TCHAR [WSAPROTOCOL_LEN+1] // Array of characters that contains a human-readable name identifying the protocol, for example "SPX2". The maximum number of characters allowed is WSAPROTOCOL_LEN, which is defined to be 255. End Type Public Type WSANAMESPACE_INFO 'Requires Windows Sockets 2.0 NSProviderId As GUID 'GUID // Unique identifier for this name-space provider. dwNameSpace As Long 'DWORD // Name space supported by this implementation of the provider. fActive As Long 'BOOL // If TRUE, indicates that this provider is active. If FALSE, the provider is inactive and is not accessible for queries, even if the query specifically references this provider. dwVersion As Long 'DWORD // Name space–version identifier. lpszIdentifier As String 'LPTSTR // Display string for the provider. End Type Public Type WSANETWORKEVENTS 'Requires Windows Sockets 2.0 lNetworkEvents As Long 'long // Indicates which of the FD_XXX network events have occurred. iErrorCode(7) As Long 'int [FD_MAX_EVENTS] // An array that contains any associated error codes, with an array index that corresponds to the position of event bits in lNetworkEvents. The identifiers FD_READ_BIT, FD_WRITE_BIT and other can be used to index the iErrorCode array. End Type Public Type WSANSCLASSINFO lpszName As String 'LPSTR dwNameSpace As Long 'DWORD dwValueType As Long 'DWORD dwValueSize As Long 'DWORD lpValue As Long 'LPVOID End Type Public Type WSASERVICECLASSINFO '(WSASERVICECLASSINFOA) Requires Windows Sockets 2.0 lpServiceClassId As GUID 'LPGUID // Unique Identifier (GUID) for the service class. lpszServiceClassName As String 'LPSTR // Well known associated with the service class. dwCount As Long 'DWORD // Number of entries in lpClassInfos. lpClassInfos() As WSANSCLASSINFO 'LPWSANSCLASSINFOA // Array of WSANSCLASSINFOW structures that contains information about the service class. End Type Public Type WSAVERSION dwVersion As Long 'DWORD ecHow As Long 'WSAECOMPARATOR // (Can be COMP_EQUAL [0] or COMP_NOTLESS [1]) End Type Public Type AFPROTOCOLS 'Requires Windows Sockets 2.0 iAddressFamily As Long 'INT // Address family to which the query is to be constrained. iProtocol As Long 'INT // Protocol to which the query is to be constrained. End Type Public Type WSAQUERYSET 'Requires Windows Sockets 2.0 dwSize As Long 'DWORD // Must be set to sizeof(WSAQUERYSET). This is a versioning mechanism. lpszServiceInstanceName As String 'LPTSTR // Ignored for queries. lpServiceClassId As GUID 'LPGUID // (Optional) Referenced string contains service name. The semantics for using wildcards within the string are not defined, but can be supported by certain name space providers. lpVersion As WSAVERSION 'LPWSAVERSION // (Required) The GUID corresponding to the service class. lpszComment As String 'LPTSTR // (Optional) References desired version number and provides version comparison semantics (that is, version must match exactly, or version must be not less than the value supplied). dwNameSpace As Long 'DWORD // Ignored for queries. lpNSProviderId As GUID 'LPGUID // Identifier of a single name space in which to constrain the search, or NS_ALL to include all name spaces. lpszContext As String 'LPTSTR // (Optional) References the GUID of a specific name-space provider, and limits the query to this provider only. dwNumberOfProtocols As String 'DWORD // (Optional) Specifies the starting point of the query in a hierarchical name space. lpafpProtocols As AFPROTOCOLS 'LPAFPROTOCOLS // Size of the protocol constraint array, can be zero. lpszQueryString() As String 'LPTSTR // (Optional) References an array of AFPROTOCOLS structure. Only services that utilize these protocols will be returned. dwNumberOfCsAddrs As Long 'DWORD // (Optional) Some name spaces (such as Whois++) support enriched SQL-like queries that are contained in a simple text string. This parameter is used to specify that string. lpcsaBuffer As CSADDR_INFO 'LPCSADDR_INFO // Ignored for queries. dwOutputFlags As Long 'DWORD // Ignored for queries. lpBlob As BLOB 'LPBLOB // (Optional) This is a pointer to a provider-specific entity. End Type Public Type WSADATA 'Requires Windows Sockets 2.0 wVersion As Integer 'WORD // Version of the Windows Sockets specification that the Ws2_32.dll expects the caller to use. wHighVersion As Integer 'WORD // Highest version of the Windows Sockets specification that this .dll can support (also encoded as above). Normally this is the same as wVersion. szDescription As String * 256 'char [WSADESCRIPTION_LEN+1] // Null-terminated ASCII string into which the Ws2_32.dll copies a description of the Windows Sockets implementation. The text (up to 256 characters in length) can contain any characters except control and formatting characters: the most likely use that an application can put this to is to display it (possibly truncated) in a status message. szSystemStatus As String * 128 'char [WSASYS_STATUS_LEN+1] // Null-terminated ASCII string into which the WSs2_32.dll copies relevant status or configuration information. The Ws2_32.dll should use this parameter only if the information might be useful to the user or support staff: it should not be considered as an extension of the szDescription parameter. iMaxSockets As Integer 'unsigned short // Retained for backward compatibility, but should be ignored for Windows Sockets version 2 and later, as no single value can be appropriate for all underlying service providers. iMaxUdpDg As Integer 'unsigned short // Ignored for Windows Sockets version 2 and onward. iMaxUdpDg is retained for compatibility with Windows Sockets specification 1.1, but should not be used when developing new applications. For the actual maximum message size specific to a particular Windows Sockets service provider and socket type, applications should use getsockopt to retrieve the value of option SO_MAX_MSG_SIZE after a socket has been created. lpVendorInfo As Long 'char far* // Ignored for Windows Sockets version 2 and onward. It is retained for compatibility with Windows Sockets specification 1.1. Applications needing to access vendor-specific configuration information should use getsockopt to retrieve the value of option PVD_CONFIG. The definition of this value (if utilized) is beyond the scope of this specification. ' NOTE : An application should ignore the iMaxsockets, iMaxUdpDg, and lpVendorInfo members in WSAData if the value in wVersion after a successful call to WSAStartup is at least 2. This is because the architecture of Windows Sockets has been changed in version 2 to support multiple providers, and WSAData no longer applies to a single vendor's stack. Two new socket options are introduced to supply provider-specific information: SO_MAX_MSG_SIZE (replaces the iMaxUdpDg element) and PVD_CONFIG (allows any other provider-specific configuration to occur). End Type ' Constants - General Public Const MAX_PATH = 260 ' Constants - CSADDR_INFO.iSocketType Public Const SOCK_STREAM = 1 ' Stream. This is a protocol that sends data as a stream of bytes, with no message boundaries. Public Const SOCK_DGRAM = 2 ' Datagram. This is a connectionless protocol. There is no virtual circuit setup. There are typically no reliability guarantees. Services use recvfrom to obtain datagrams. The listen and accept functions do not work with datagrams. Public Const SOCK_RAW = 3 ' Raw-protocol interface Public Const SOCK_RDM = 4 ' Reliably-Delivered Message. This is a protocol that preserves message boundaries in data. Public Const SOCK_SEQPACKET = 5 ' Sequenced packet stream. This is a protocol that is essentially the same as SOCK_RDM. ' Constants - EnumProtocols.lpiProtocols Public Const IPPROTO_TCP = 6 ' TCP/IP, a connection/stream-oriented protocol. Public Const IPPROTO_UDP = 17 ' User Datagram Protocol (UDP/IP), a connectionless datagram protocol. Public Const ISOPROTO_TP4 = 29 ' ISO connection-oriented transport protocol. Public Const NSPROTO_IPX = 1000 ' IPX. Public Const NSPROTO_SPX = 1256 ' SPX. Public Const NSPROTO_SPXII = 1257 ' SPX II. ' PROTOCOL_INFO.dwServiceFlags Public Const XP_CONNECTIONLESS = &H1 ' If this flag is set, the protocol provides connectionless (datagram) service. If this flag is clear, the protocol provides connection-oriented data transfer. Public Const XP_GUARANTEED_DELIVERY = &H2 ' If this flag is set, the protocol guarantees that all data sent will reach the intended destination. If this flag is clear, there is no such guarantee. Public Const XP_GUARANTEED_ORDER = &H4 ' If this flag is set, the protocol guarantees that data will arrive in the order in which it was sent. Note that this characteristic does not guarantee delivery of the data, only its order. If this flag is clear, the order of data sent is not guaranteed. Public Const XP_MESSAGE_ORIENTED = &H8 ' If this flag is set, the protocol is message-oriented. A message-oriented protocol honors message boundaries. If this flag is clear, the protocol is stream oriented, and the concept of message boundaries is irrelevant. Public Const XP_PSEUDO_STREAM = &H10 ' If this flag is set, the protocol is a message-oriented protocol that ignores message boundaries for all receive operations. This optional capability is useful when you do not want the protocol to frame messages. An application that requires stream-oriented characteristics can open a socket with type SOCK_STREAM for transport protocols that support this functionality, regardless of the value of iSocketType. Public Const XP_GRACEFUL_CLOSE = &H20 ' If this flag is set, the protocol supports two-phase close operations, also known as graceful close operations. If this flag is clear, the protocol supports only abortive close operations. Public Const XP_EXPEDITED_DATA = &H40 ' If this flag is set, the protocol supports expedited data, also known as urgent data. Public Const XP_CONNECT_DATA = &H80 ' If this flag is set, the protocol supports connect data. Public Const XP_DISCONNECT_DATA = &H100 ' If this flag is set, the protocol supports disconnect data. Public Const XP_SUPPORTS_BROADCAST = &H200 ' If this flag is set, the protocol supports a broadcast mechanism. Public Const XP_SUPPORTS_MULTICAST = &H400 ' If this flag is set, the protocol supports a multicast mechanism. Public Const XP_BANDWIDTH_ALLOCATION = &H800 ' If this flag is set, the protocol supports a mechanism for allocating a guaranteed bandwidth to an application. Public Const XP_FRAGMENTATION = &H1000 ' If this flag is set, the protocol supports message fragmentation; physical network MTU is hidden from applications. Public Const XP_ENCRYPTS = &H2000 ' If this flag is set, the protocol supports data encryption. ' Constants - GetAddressByName.dwNameSpace / GetService.dwNameSpace / SetService.dwNameSpace Public Const NS_DEFAULT = 0 ' A set of default name spaces. The function queries each name space within this set. The set of default name spaces typically includes all the name spaces installed on the system. System administrators, however, can exclude particular name spaces from the set. This is the value that most applications should use for dwNameSpace. Public Const NS_DNS = 12 ' The Domain Name System used in the Internet for host name resolution. Public Const NS_NDS = 2 ' The NetWare 4 provider. Public Const NS_NETBT = 13 ' The NetBIOS over TCP/IP layer. All Windows NT/Windows 2000 systems register their computer names with NetBIOS. This name space is used to convert a computer name to an IP address that uses this registration. Note that NS_NETBT can access a WINS server to perform the resolution. Public Const NS_SAP = 1 ' The Netware Service Advertising Protocol. This can access the Netware bindery if appropriate. NS_SAP is a dynamic name space that allows registration of services. Public Const NS_TCPIP_HOSTS = 11 ' Lookup value in the \system32\drivers\etc\hosts file. Public Const NS_TCPIP_LOCAL = 10 ' Local TCP/IP name resolution mechanisms, including comparisons against the local host name and looks up host names and IP addresses in cache of host to IP address mappings. Public Const NS_PEER_BROWSE = 3 Public Const NS_WINS = 14 Public Const NS_NBP = 20 Public Const NS_MS = 30 Public Const NS_STDA = 31 Public Const NS_NTDS = 32 Public Const NS_X500 = 40 Public Const NS_NIS = 41 Public Const NS_VNS = 50 ' Constants - GetAddressByName.dwResolution Public Const RES_SOFT_SEARCH = &H1 ' This flag is valid if the name space supports multiple levels of searching. If this flag is valid and set, the operating system performs a simple and quick search of the name space. This is useful if an application only needs to obtain easy-to-find addresses for the service. If this flag is valid and clear, the operating system performs a more extensive search of the name space. Public Const RES_FIND_MULTIPLE = &H2 ' If this flag is set, the operating system performs an extensive search of all name spaces for the service. It asks every appropriate name space to resolve the service name. If this flag is clear, the operating system stops looking for service addresses as soon as one is found. Public Const RES_SERVICE = &H4 ' If set, the function obtains the address to which a service of the specified type should bind. This is the equivalent of setting lpServiceName to NULL. If this flag is clear, normal name resolution occurs. ' Constants - gethostbyaddr.type Public Const AF_UNIX = 1 ' Local to host (pipes, portals) Public Const AF_INET = 2 ' Internetwork: UDP, TCP, etc. Public Const AF_IMPLINK = 3 ' Arpanet imp addresses Public Const AF_PUP = 4 ' Pup protocols: e.g. BSP Public Const AF_CHAOS = 5 ' Mit CHAOS protocols Public Const AF_NS = 6 ' XEROX NS protocols Public Const AF_IPX = AF_NS ' IPX protocols: IPX, SPX, etc. Public Const AF_ISO = 7 ' ISO protocols Public Const AF_OSI = AF_ISO ' OSI is ISO Public Const AF_ECMA = 8 ' European computer manufacturers Public Const AF_DATAKIT = 9 ' Datakit protocols Public Const AF_CCITT = 10 ' CCITT protocols, X.25 etc Public Const AF_SNA = 11 ' IBM SNA Public Const AF_DECnet = 12 ' DECnet Public Const AF_DLI = 13 ' Direct data link interface Public Const AF_LAT = 14 ' LAT Public Const AF_HYLINK = 15 ' NSC Hyperchannel Public Const AF_APPLETALK = 16 ' AppleTalk Public Const AF_NETBIOS = 17 ' NetBios-style addresses Public Const AF_VOICEVIEW = 18 ' VoiceView Public Const AF_FIREFOX = 19 ' Protocols from Firefox Public Const AF_UNKNOWN1 = 20 ' Somebody is using this! Public Const AF_BAN = 21 ' Banyan Public Const AF_ATM = 22 ' Native ATM Services Public Const AF_INET6 = 23 ' Internetwork Version 6 ' Constants - GetService.dwProperties Public Const PROP_COMMENT = &H1 ' If this flag is set, the function stores data in the lpComment member of the data structures stored in *lpBuffer. Public Const PROP_LOCALE = &H2 ' If this flag is set, the function stores data in the lpLocale member of the data structures stored in *lpBuffer. Public Const PROP_DISPLAY_HINT = &H4 ' If this flag is set, the function stores data in the dwDisplayHint member of the data structures stored in *lpBuffer. Public Const PROP_VERSION = &H8 ' If this flag is set, the function stores data in the dwVersion member of the data structures stored in *lpBuffer. Public Const PROP_START_TIME = &H10 ' If this flag is set, the function stores data in the dwTime member of the data structures stored in *lpBuffer. Public Const PROP_MACHINE = &H20 ' If this flag is set, the function stores data in the lpMachineName member of the data structures stored in *lpBuffer. Public Const PROP_ADDRESSES = &H100 ' If this flag is set, the function stores data in the lpServiceAddress member of the data structures stored in *lpBuffer. Public Const PROP_SD = &H200 ' If this flag is set, the function stores data in the ServiceSpecificInfo member of the data structures stored in *lpBuffer. Public Const PROP_ALL = &H80000000 ' If this flag is set, the function stores data in all of the members of the data structures stored in *lpBuffer. ' Constants - SERVICE_ADDRESS.dwAddressFlags Public Const SERVICE_ADDRESS_FLAG_RPC_CN = &H1 'If this bit flag is set, the service supports connection-oriented RPC over this transport protocol. Public Const SERVICE_ADDRESS_FLAG_RPC_DG = &H2 'If this bit flag is set, the service supports datagram-oriented RPC over this transport protocol. Public Const SERVICE_ADDRESS_FLAG_RPC_NB = &H4 'If this bit flag is set, the service supports NetBIOS RPC over this transport protocol. ' Constants - getsockopt.level (See MSDN for information about .level and .optval) Public Const SOL_SOCKET = &HFFFF 'Public Const IPPROTO_TCP = 6 'Public Const NSPROTO_IPX = 1000 ' Constants - getsockopt.optval / setsockopt.optval Public Const SO_ACCEPTCONN = &H2 ' Socket is listening. Public Const SO_BROADCAST = &H20 ' Socket is configured for the transmission of broadcast messages. Public Const SO_DEBUG = &H1 ' Debugging is enabled. Public Const SO_DONTROUTE = &H10 ' Routing is disabled. Not supported on ATM sockets. Public Const SO_ERROR = &H1007 ' Retrieves error status and clear. Public Const SO_GROUP_ID = &H2001 ' Reserved. Public Const SO_GROUP_PRIORITY = &H2002 ' Reserved. Public Const SO_KEEPALIVE = &H8 ' Keep-alives are being sent. Not supported on ATM sockets. Public Const SO_LINGER = &H80 ' Returns the current linger options. Public Const SO_DONTLINGER = Not SO_LINGER ' If TRUE, the SO_LINGER option is disabled. Public Const SO_MAX_MSG_SIZE = &H2003 ' Maximum size of a message for message-oriented socket types (for example, SOCK_DGRAM). Has no meaning for stream oriented sockets. Public Const SO_OOBINLINE = &H100 ' OOB data is being received in the normal data stream. (See section Windows Sockets 1.1 Blocking Routines and EINPROGRESS for a discussion of this topic.) Public Const SO_PROTOCOL_INFO = &H2004 ' Description of protocol information for protocol that is bound to this socket. Public Const SO_RCVBUF = &H1002 ' Buffer size for receives. Public Const SO_RCVLOWAT = &H1004 ' Receives low watermark. Public Const SO_RCVTIMEO = &H1006 ' Receives time-out (available in Microsoft implementation of Windows Sockets 2). Public Const SO_REUSEADDR = &H4 ' The socket can be bound to an address which is already in use. Not applicable for ATM sockets. Public Const SO_SNDBUF = &H1001 ' Buffer size for sends. Public Const SO_SNDLOWAT = &H1003 ' Sends low watermark. Public Const SO_SNDTIMEO = &H1005 ' Sends time-out (available in Microsoft implementation of Windows Sockets 2). Public Const SO_TYPE = &H1008 ' The type of the socket (for example, SOCK_STREAM). Public Const PVD_CONFIG = &H3001 ' An opaque data structure object from the service provider associated with socket s. This object stores the current configuration information of the service provider. The exact format of this data structure is service provider specific. Public Const TCP_NODELAY = &H1 ' Disables the Nagle algorithm for send coalescing. Public Const IPX_PTYPE = &H4000 ' Obtains the IPX packet type. Public Const IPX_FILTERPTYPE = &H4001 ' Obtains the receive filter packet type Public Const IPX_DSTYPE = &H4002 ' Obtain the value of the data stream field in the SPX header on every packet sent. Public Const IPX_EXTENDED_ADDRESS = &H4004 ' Find out whether extended addressing is enabled. Public Const IPX_RECVHDR = &H4005 ' Find out whether the protocol header is sent up on all receive headers. Public Const IPX_MAXSIZE = &H4006 ' Obtain the maximum data size that can be sent. Public Const IPX_ADDRESS = &H4007 ' Obtain information about a specific adapter to which IPX is bound. Adapter numbering is base zero. The adapternum member is filled in upon return. Public Const IPX_GETNETINFO = &H4008 ' Obtain information about a specific IPX network number. If not available in the cache, uses RIP to obtain information. Public Const IPX_GETNETINFO_NORIP = &H4009 ' Obtain information about a specific IPX network number. If not available in the cache, will not use RIP to obtain information, and returns error. Public Const IPX_SPXGETCONNECTIONSTATUS = &H400B ' Obtains information about a connected SPX socket. Public Const IPX_ADDRESS_NOTIFY = &H400C ' Obtains status notification when changes occur on an adapter to which IPX is bound. Public Const IPX_MAX_ADAPTER_NUM = &H400D ' Obtains maximum number of adapters present, numbered as base zero. Public Const IPX_RERIPNETNUMBER = &H400E ' Similar to IPX_GETNETINFO, but forces IPX to use RIP for resolution, even if the network information is in the local cache. Public Const IPX_IMMEDIATESPXACK = &H4010 ' Directs SPX connections not to delay before sending an ACK. Applications without back-and-forth traffic should set this to TRUE to increase performance. Public Const IPX_STOPFILTERPTYPE = &H4003 ' Stop filtering the filter type set with IPX_FILTERTYPE Public Const IPX_RECEIVE_BROADCAST = &H400F ' Indicates broadcast packets are likely on the socket. Set to TRUE by default. Applications that do not use broadcasts should set this to FALSE for better system performance. 'Public Const SO_CONDITIONAL_ACCEPT = ? ' Returns current socket state, either from a previous call to setsockopt or the system default. 'Public Const SO_EXCLUSIVEADDRUSE = ? ' Enables a socket to be bound for exclusive access. Requires Windows NT 4.0 SP4 or Windows 2000. ' Constants - inet_addr (return) Public Const INADDR_NONE = &HFFFFFFFF ' Constants - recv.flags / recvfrom.flags / send.flags / sendto.flags / WSARecv.lpFlags Public Const MSG_OOB = &H1 ' Process out-of-band data Public Const MSG_PEEK = &H2 ' Peek at incoming message Public Const MSG_DONTROUTE = &H4 ' Send without using routing tables Public Const MSG_PARTIAL = &H8000 ' Partial send or recv for message xport ' Constants - SetService.dwOperation Public Const SERVICE_REGISTER = &H1 ' Register the network service with the name space. This operation can be used with the SERVICE_FLAG_DEFER and SERVICE_FLAG_HARD bit flags. Public Const SERVICE_DEREGISTER = &H2 ' Remove from the registry the network service from the name space. This operation can be used with the SERVICE_FLAG_DEFER and SERVICE_FLAG_HARD bit flags. Public Const SERVICE_FLUSH = &H3 ' Perform any operation that was called with the SERVICE_FLAG_DEFER bit flag set to one. Public Const SERVICE_ADD_TYPE = &H4 ' Add a service type to the name space. For this operation, use the ServiceSpecificInfo member of the SERVICE_INFO structure pointed to by lpServiceInfo to pass a SERVICE_TYPE_INFO_ABS structure. You must also set the ServiceType member of the SERVICE_INFO structure. Other SERVICE_INFO members are ignored. Public Const SERVICE_DELETE_TYPE = &H5 ' Remove a service type, added by a previous call specifying the SERVICE_ADD_TYPE operation, from the name space. ' Constants - SetService.dwFlags Public Const SERVICE_FLAG_DEFER = &H1 ' This bit flag is valid only if the operation is SERVICE_REGISTER or SERVICE_DEREGISTER. If this bit flag is one, and it is valid, the name-space provider should defer the registration or deregistration operation until a SERVICE_FLUSH operation is requested. Public Const SERVICE_FLAG_HARD = &H2 ' This bit flag is valid only if the operation is SERVICE_REGISTER or SERVICE_DEREGISTER. If this bit flag is one, and it is valid, the name-space provider updates any relevant persistent store information when the operation is performed. For example: If the operation involves deregistration in a name space that uses a persistent store, the name-space provider would remove the relevant persistent store information. ' Constants - SetService.lpdwStatusFlags Public Const SET_SERVICE_PARTIAL_SUCCESS = &H1 ' One or more name-space providers were unable to successfully perform the requested operation. ' Constants - shutdown.how Public Const SD_RECEIVE = &H0 ' If the how parameter is SD_RECEIVE, subsequent calls to the recv function on the socket will be disallowed. This has no effect on the lower protocol layers. For TCP sockets, if there is still data queued on the socket waiting to be received, or data arrives subsequently, the connection is reset, since the data cannot be delivered to the user. For UDP sockets, incoming datagrams are accepted and queued. In no case will an ICMP error packet be generated. Public Const SD_SEND = &H1 ' If the how parameter is SD_SEND, subsequent calls to the send function are disallowed. For TCP sockets, a FIN will be sent after all data is sent and acknowledged by the receiver. Public Const SD_BOTH = &H2 ' Setting how to SD_BOTH disables both sends and receives as described above. ' Constants - TransmitFile.dwFlags Public Const TF_DISCONNECT = &H1 ' Start a transport-level disconnect after all the file data has been queued for transmission. Public Const TF_REUSE_SOCKET = &H2 ' Prepare the socket handle to be reused. When the TransmitFile request completes, the socket handle can be passed to the AcceptEx function. It is only valid if TF_DISCONNECT is also specified. Public Const TF_WRITE_BEHIND = &H4 ' Complete the TransmitFile request immediately, without pending. If this flag is specified and TransmitFile succeeds, then the data has been accepted by the system but not necessarily acknowledged by the remote end. Do not use this setting with the TF_DISCONNECT and TF_REUSE_SOCKET flags. 'Public Const TF_USE_DEFAULT_WORKER = ? ' Directs the Windows Sockets service provider to use the system's default thread to process long TransmitFile requests. The system default thread can be adjusted using the following registry parameter as a REG_DWORD:CurrentControlSet\Services\afd\Parameters\TransmitWorker 'Public Const TF_USE_SYSTEM_THREAD = ? ' Directs the Windows Sockets service provider to use system threads to process long TransmitFile requests. 'Public Const TF_USE_KERNEL_APC = ? ' Directs the driver to use kernel Asynchronous Procedure Calls (APCs) instead of worker threads to process long TransmitFile requests. Long TransmitFile requests are defined as requests that require more than a single read from the file or a cache; the request therefore depends on the size of the file and the specified length of the send packet. Use of TF_USE_KERNEL_APC can deliver significant performance benefits. It is possible (though unlikely), however, that the thread in which context TransmitFile is initiated is being used for heavy computations; this situation may prevent APCs from launching. Note that the Windows Sockets kernel mode driver uses normal kernel APCs, which launch whenever a thread is in a wait state, which differs from user-mode APCs, which launch whenever a thread is in an alertable wait state initiated in user mode). ' Constants - WSAPROTOCOL_INFO.dwServiceFlags1 Public Const XP1_CONNECTIONLESS = &H1 ' Provides connectionless (datagram) service. If not set, the protocol supports connection-oriented data transfer. Public Const XP1_GUARANTEED_DELIVERY = &H2 ' Guarantees that all data sent will reach the intended destination. Public Const XP1_GUARANTEED_ORDER = &H4 ' Guarantees that data only arrives in the order in which it was sent and that it is not duplicated. This characteristic does not necessarily mean that the data is always delivered, but that any data that is delivered is delivered in the order in which it was sent. Public Const XP1_MESSAGE_ORIENTED = &H8 ' Honors message boundaries—as opposed to a stream-oriented protocol where there is no concept of message boundaries. Public Const XP1_PSEUDO_STREAM = &H10 ' A message-oriented protocol, but message boundaries are ignored for all receipts. This is convenient when an application does not desire message framing to be done by the protocol. Public Const XP1_GRACEFUL_CLOSE = &H20 ' Supports two-phase (graceful) close. If not set, only abortive closes are performed. Public Const XP1_EXPEDITED_DATA = &H40 ' Supports expedited (urgent) data. Public Const XP1_CONNECT_DATA = &H80 ' Supports connect data. Public Const XP1_DISCONNECT_DATA = &H100 ' Supports disconnect data. Public Const XP1_INTERRUPT = &H4000 ' Bit is reserved. Public Const XP1_SUPPORT_BROADCAST = &H200 ' Supports a broadcast mechanism. Public Const XP1_SUPPORT_MULTIPOINT = &H400 ' Supports a multipoint or multicast mechanism. Control and data plane attributes are indicated below. Public Const XP1_MULTIPOINT_CONTROL_PLANE = &H800 ' Indicates whether the control plane is rooted (value = 1) or nonrooted (value = 0). Public Const XP1_MULTIPOINT_DATA_PLANE = &H1000 ' Indicates whether the data plane is rooted (value = 1) or nonrooted (value = 0). Public Const XP1_QOS_SUPPORTED = &H2000 ' Supports quality of service requests. Public Const XP1_UNI_SEND = &H8000 ' Protocol is unidirectional in the send direction. Public Const XP1_UNI_RECV = &H10000 ' Protocol is unidirectional in the recv direction. Public Const XP1_IFS_HANDLES = &H20000 ' Socket descriptors returned by the provider are operating system Installable File System (IFS) handles. Public Const XP1_PARTIAL_MESSAGE = &H40000 ' The MSG_PARTIAL flag is supported in WSASend and WSASendTo. ' Constants - WSAPROTOCOL_INFO.dwProviderFlags Public Const PFL_MULTIPLE_PROTO_ENTRIES = &H1 ' Indicates that this is one of two or more entries for a single protocol (from a given provider) which is capable of implementing multiple behaviors. An example of this is SPX which, on the receiving side, can behave either as a message-oriented or a stream-oriented protocol. Public Const PFL_RECOMMENDED_PROTO_ENTRY = &H2 ' Indicates that this is the recommended or most frequently used entry for a protocol that is capable of implementing multiple behaviors. Public Const PFL_HIDDEN = &H4 ' Set by a provider to indicate to the Ws2_32.dll that this protocol should not be returned in the result buffer generated by WSAEnumProtocols. Obviously, a Windows Sockets 2 application should never see an entry with this bit set. Public Const PFL_MATCHES_PROTOCOL_ZERO = &H8 ' Indicates that a value of zero in the protocol parameter of socket or WSASocket matches this protocol entry. ' Constants - WSAAsyncSelect.lEvent / WSAAsyncSelect (Return) Public Const FD_READ = &H1 ' INPUT = Wants to receive notification of readiness for reading. ' OUTPUT = Socket ready for reading. Public Const FD_WRITE = &H2 ' INPUT = Wants to receive notification of readiness for writing. ' OUTPUT = Socket ready for writing. Public Const FD_OOB = &H4 ' INPUT = Wants to receive notification of the arrival of OOB data. ' OUTPUT = OOB data ready for reading on socket. Public Const FD_ACCEPT = &H8 ' INPUT = Wants to receive notification of incoming connections. ' OUTPUT = Socket ready for accepting a new incoming connection. Public Const FD_CONNECT = &H10 ' INPUT = Wants to receive notification of completed connection or multipoint join operation. ' OUTPUT = Connection or multipoint join operation initiated on socket completed. Public Const FD_CLOSE = &H20 ' INPUT = Wants to receive notification of socket closure. ' OUTPUT = Connection identified by socket has been closed. Public Const FD_QOS = &H40 ' INPUT = Wants to receive notification of socket Quality of Service (QOS) changes. ' OUTPUT = Quality of Service associated with socket has changed. Public Const FD_GROUP_QOS = &H80 ' INPUT = Reserved ' OUTPUT = Reserved Public Const FD_ROUTING_INTERFACE_CHANGE = &H100 ' INPUT = Wants to receive notification of routing interface changes for the specified destination(s). ' OUTPUT = Local interface that should be used to send to the specified destination has changed. Public Const FD_ADDRESS_LIST_CHANGE = &H200 ' INPUT = Wants to receive notification of local address list changes for the socket's protocol family. ' OUTPUT = The list of addresses of the socket's protocol family to which the application client can bind has changed. ' Constants - WSALookupServiceBegin.dwControlFlags Public Const LUP_DEEP = &H1 ' Queries deep as opposed to just the first level. Public Const LUP_CONTAINERS = &H2 ' Returns containers only. Public Const LUP_NOCONTAINERS = &H4 ' Does not return any containers. Public Const LUP_FLUSHCACHE = &H1000 ' If the provider has been caching information, ignores the cache, and queries the name space itself. Public Const LUP_FLUSHPREVIOUS = &H2000 ' Used as a value for the dwControlFlags parameter in WSALookupServiceNext. Setting this flag instructs the provider to discard the last result set, which was too large for the supplied buffer, and move on to the next result set. Public Const LUP_NEAREST = &H8 ' If possible, returns results in the order of distance. The measure of distance is provider specific. Public Const LUP_RES_SERVICE = &H8000 ' This indicates whether prime response is in the remote or local part of CSADDR_INFO structure. The other part needs to be usable in either case. Public Const LUP_RETURN_ALIASES = &H400 ' Any available alias information is to be returned in successive calls to WSALookupServiceNext, and each alias returned will have the RESULT_IS_ALIAS flag set. Public Const LUP_RETURN_NAME = &H10 ' Retrieves the name as lpszServiceInstanceName. Public Const LUP_RETURN_TYPE = &H20 ' Retrieves the type as lpServiceClassId. Public Const LUP_RETURN_VERSION = &H40 ' Retrieves the version as lpVersion. Public Const LUP_RETURN_COMMENT = &H80 ' Retrieves the comment as lpszComment. Public Const LUP_RETURN_ADDR = &H100 ' Retrieves the addresses as lpcsaBuffer. Public Const LUP_RETURN_BLOB = &H200 ' Retrieves the private data as lpBlob. Public Const LUP_RETURN_ALL = &HFF0 ' Retrieves all of the information. ' Constants - WSASetService.essOperation Public Enum WSAESETSERVICEOP RNRSERVICE_REGISTER = 0 ' Register the service. For SAP, this means sending out a periodic broadcast. This is an NOP for the DNS name space. For persistent data stores, this means updating the address information. RNRSERVICE_DEREGISTER ' Remove the service from the registry. For SAP, this means stop sending out the periodic broadcast. This is an NOP for the DNS name space. For persistent data stores this means deleting address information. RNRSERVICE_DELETE ' Delete the service from dynamic name and persistent spaces. For services represented by multiple CSADDR_INFO structures (using the SERVICE_MULTIPLE flag), only the supplied address will be deleted, and this must match exactly the corresponding CSADDR_INFO structure that was supplied when the service was registered. End Enum ' Constants - WSASetService.dwControlFlags Public Const SERVICE_MULTIPLE = &H1 ' Controls scope of operation. When clear, service addresses are managed as a group. A register or removal from the registry invalidates all existing addresses before adding the given address set. When set, the action is only performed on the given address set. A register does not invalidate existing addresses and a removal from the registry only invalidates the given set of addresses. ' Constants - WSASocket.dwFlags Public Const WSA_FLAG_OVERLAPPED = &H1 'This flag causes an overlapped socket to be created. Overlapped sockets can utilize WSASend, WSASendTo, WSARecv, WSARecvFrom, and WSAIoctl for overlapped I/O operations, which allow multiple operations to be initiated and in progress simultaneously. All functions that allow overlapped operation (WSASend, WSARecv, WSASendTo, WSARecvFrom, WSAIoctl) also support nonoverlapped usage on an overlapped socket if the values for parameters related to overlapped operations are NULL. Public Const WSA_FLAG_MULTIPOINT_C_ROOT = &H2 ' Indicates that the socket created will be a c_root in a multipoint session. Only allowed if a rooted control plane is indicated in the protocol's WSAPROTOCOL_INFO structure. Refer to Multipoint and Multicast Semantics for additional information. Public Const WSA_FLAG_MULTIPOINT_C_LEAF = &H4 'Indicates that the socket created will be a c_leaf in a multicast session. Only allowed if XP1_SUPPORT_MULTIPOINT is indicated in the protocol's WSAPROTOCOL_INFO structure. Refer to Multipoint and Multicast Semantics for additional information. Public Const WSA_FLAG_MULTIPOINT_D_ROOT = &H8 'Indicates that the socket created will be a d_root in a multipoint session. Only allowed if a rooted data plane is indicated in the protocol's WSAPROTOCOL_INFO structure. Refer to Multipoint and Multicast Semantics for additional information. Public Const WSA_FLAG_MULTIPOINT_D_LEAF = &H10 'Indicates that the socket created will be a d_leaf in a multipoint session. Only allowed if XP1_SUPPORT_MULTIPOINT is indicated in the protocol's WSAPROTOCOL_INFO structure. Refer to Multipoint and Multicast Semantics for additional information. ' Constants - WSAWaitForMultipleEvents (Return) Public Const WSA_WAIT_EVENT_0 = &H0 ' WSA_WAIT_EVENT_0 = WAIT_OBJECT_0 = STATUS_WAIT_0 = 0x00000000 Public Const WSA_WAIT_IO_COMPLETION = &HC0 ' WSA_WAIT_IO_COMPLETION = WAIT_IO_COMPLETION = STATUS_USER_APC = 0x000000C0 Public Const WSA_WAIT_TIMEOUT = &H102 ' WSA_WAIT_TIMEOUT = WAIT_TIMEOUT = 258 ' Constants Windows Sockets base error number Public Const WSABASEERR = 10000 ' Constants - Windows Sockets definitions of regular Microsoft C error constants Public Const WSAEINTR = (WSABASEERR + 4) ' Interrupted system call Public Const WSAEBADF = (WSABASEERR + 9) ' Bad file number Public Const WSEACCES = (WSABASEERR + 13) ' Permission denied Public Const WSAEFAULT = (WSABASEERR + 14) ' Bad address Public Const WSAEINVAL = (WSABASEERR + 22) ' Invalid argument Public Const WSAEMFILE = (WSABASEERR + 24) ' Too many open files ' Constants - Windows Sockets definitions of regular Berkeley error constants Public Const WSAEWOULDBLOCK = (WSABASEERR + 35) ' A non-blocking socket operation could not be completed immediately Public Const WSAEINPROGRESS = (WSABASEERR + 36) ' A blocking operation is currently executing Public Const WSAEALREADY = (WSABASEERR + 37) ' An operation was attempted on a non-blocking socket that already had an operation in progress Public Const WSAENOTSOCK = (WSABASEERR + 38) ' An operation was attempted on something that is not a socket Public Const WSAEDESTADDRREQ = (WSABASEERR + 39) ' A required address was omitted from an operation on a socket Public Const WSAEMSGSIZE = (WSABASEERR + 40) ' A message sent on a datagram socket was larger than the internal message buffer or some other network limit, or the buffer used to receive a datagram into was smaller than the datagram itself Public Const WSAEPROTOTYPE = (WSABASEERR + 41) ' A protocol was specified in the socket function call that does not support the semantics of the socket type requested Public Const WSAENOPROTOOPT = (WSABASEERR + 42) ' An unknown, invalid, or unsupported option or level was specified in a getsockopt or setsockopt call Public Const WSAEPROTONOSUPPORT = (WSABASEERR + 43) ' The requested protocol has not been configured into the system, or no implementation for it exists Public Const WSAESOCKTNOSUPPORT = (WSABASEERR + 44) ' The support for the specified socket type does not exist in this address family Public Const WSAEOPNOTSUPP = (WSABASEERR + 45) ' The attempted operation is not supported for the type of object referenced Public Const WSAEPFNOSUPPORT = (WSABASEERR + 46) ' The protocol family has not been configured into the system or no implementation for it exists Public Const WSAEAFNOSUPPORT = (WSABASEERR + 47) ' An address incompatible with the requested protocol was used Public Const WSAEADDRINUSE = (WSABASEERR + 48) ' Address already in use - Only one usage of each socket address (protocol/network address/port) is normally permitted Public Const WSAEADDRNOTAVAIL = (WSABASEERR + 49) ' The requested address is not valid in its context Public Const WSAENETDOWN = (WSABASEERR + 50) ' Network is down - This error may be reported at any time if the Windows Sockets implementation detects an underlying failure Public Const WSAENETUNREACH = (WSABASEERR + 51) ' Network is unreachable - A socket operation encountered a dead network Public Const WSAENETRESET = (WSABASEERR + 52) ' The connection has been broken due to keep-alive activity detecting a failure while the operation was in progress Public Const WSAECONNABORTED = (WSABASEERR + 53) ' An established connection was aborted by the software in your host machine Public Const WSAECONNRESET = (WSABASEERR + 54) ' An existing connection was forcibly closed by the remote host Public Const WSAENOBUFS = (WSABASEERR + 55) ' An operation on a socket could not be performed because the system lacked sufficient buffer space or because a queue was full Public Const WSAEISCONN = (WSABASEERR + 56) ' A connect request was made on an already connected socket Public Const WSAENOTCONN = (WSABASEERR + 57) ' Socket is not connected - A request to send or receive data was disallowed because the socket is not connected and (when sending on a datagram socket using a sendto call) no address was supplied Public Const WSAESHUTDOWN = (WSABASEERR + 58) ' A request to send or receive data was disallowed because the socket had already been shut down in that direction with a previous shutdown call Public Const WSAETOOMANYREFS = (WSABASEERR + 59) ' Too many references to some kernel object Public Const WSAETIMEDOUT = (WSABASEERR + 60) ' A connection attempt failed because the connected party did not properly respond after a period of time, or established connection failed because connected host has failed to respond Public Const WSAECONNREFUSED = (WSABASEERR + 61) ' No connection could be made because the target machine actively refused it Public Const WSAELOOP = (WSABASEERR + 62) ' Too many levels of symbolic links - Cannot translate name Public Const WSAENAMETOOLONG = (WSABASEERR + 63) ' Name component or name was too long Public Const WSAEHOSTDOWN = (WSABASEERR + 64) ' A socket operation failed because the destination host was down Public Const WSAEHOSTUNREACH = (WSABASEERR + 65) ' A socket operation was attempted to an unreachable host Public Const WSAENOTEMPTY = (WSABASEERR + 66) ' Cannot remove a directory that is not empty Public Const WSAEPROCLIM = (WSABASEERR + 67) ' A Windows Sockets implementation may have a limit on the number of applications that may use it simultaneously Public Const WSAEUSERS = (WSABASEERR + 68) ' Ran out of quota Public Const WSAEDQUOT = (WSABASEERR + 69) ' Ran out of disk quota Public Const WSAESTALE = (WSABASEERR + 70) ' File handle reference is no longer available Public Const WSAEREMOTE = (WSABASEERR + 71) ' Item is not available locally ' Constants - Extended Windows Sockets error constant definitions Public Const WSASYSNOTREADY = (WSABASEERR + 91) ' WSAStartup cannot function at this time because the underlying system it uses to provide network services is currently unavailable Public Const WSAVERNOTSUPPORTED = (WSABASEERR + 92) ' The Windows Sockets version requested is not supported Public Const WSANOTINITIALISED = (WSABASEERR + 93) ' Either the application has not called WSAStartup, or WSAStartup failed Public Const WSAEDISCON = (WSABASEERR + 101) ' Disconnect Public Const WSAENOMORE = (WSABASEERR + 102) ' No more results can be returned by WSALookupServiceNext Public Const WSAECANCELLED = (WSABASEERR + 103) ' A call to WSALookupServiceEnd was made while this call was still processing - The call has been canceled Public Const WSAEINVALIDPROCTABLE = (WSABASEERR + 104) ' The procedure call table is invalid Public Const WSAEINVALIDPROVIDER = (WSABASEERR + 105) ' The requested service provider is invalid Public Const WSAEPROVIDERFAILEDINIT = (WSABASEERR + 106) ' The requested service provider could not be loaded or initialized Public Const WSASYSCALLFAILURE = (WSABASEERR + 107) ' A system call that should never fail has failed Public Const WSASERVICE_NOT_FOUND = (WSABASEERR + 108) ' No such service is known - The service cannot be found in the specified name space Public Const WSATYPE_NOT_FOUND = (WSABASEERR + 109) ' The specified class was not found Public Const WSA_E_NO_MORE = (WSABASEERR + 110) ' No more results can be returned by WSALookupServiceNext Public Const WSA_E_CANCELLED = (WSABASEERR + 111) ' A call to WSALookupServiceEnd was made while this call was still processing - The call has been canceled Public Const WSAEREFUSED = (WSABASEERR + 112) ' A database query failed because it was actively refused ' Constants - Error return codes from GetHostByName() and GetHostByAddr() (when using the resolver) Public Const WSAHOST_NOT_FOUND = (WSABASEERR + 1001) ' Host not found - This message indicates that the key (name, address, and so on) was not found Public Const WSATRY_AGAIN = (WSABASEERR + 1002) ' Nonauthoritative host not found - This error may suggest that the name service itself is not functioning Public Const WSANO_RECOVERY = (WSABASEERR + 1003) ' Nonrecoverable error - This error may suggest that the name service itself is not functioning Public Const WSANO_DATA = (WSABASEERR + 1004) ' Valid name, no data record of requested type - This error indicates that the key (name, address, and so on) was not found ' Constants - Define QOS related error return codes Public Const WSA_QOS_RECEIVERS = (WSABASEERR + 1005) ' At least one Reserve has arrived Public Const WSA_QOS_SENDERS = (WSABASEERR + 1006) ' At least one Path has arrived Public Const WSA_QOS_NO_SENDERS = (WSABASEERR + 1007) ' There are no senders Public Const WSA_QOS_NO_RECEIVERS = (WSABASEERR + 1008) ' There are no receivers Public Const WSA_QOS_REQUEST_CONFIRMED = (WSABASEERR + 1009) ' Reserve has been confirmed Public Const WSA_QOS_ADMISSION_FAILURE = (WSABASEERR + 1010) ' Error due to lack of resources Public Const WSA_QOS_POLICY_FAILURE = (WSABASEERR + 1011) ' Rejected for administrative reasons - bad credentials Public Const WSA_QOS_BAD_STYLE = (WSABASEERR + 1012) ' Unknown or conflicting style Public Const WSA_QOS_BAD_OBJECT = (WSABASEERR + 1013) ' Problem with some part of the filterspec or providerspecific buffer in general Public Const WSA_QOS_TRAFFIC_CTRL_ERROR = (WSABASEERR + 1014) ' Problem with some part of the flowspec Public Const WSA_QOS_GENERIC_ERROR = (WSABASEERR + 1015) ' General QOS error Public Const WSA_QOS_ESERVICETYPE = (WSABASEERR + 1016) ' An invalid or unrecognized service type was found in the flowspec Public Const WSA_QOS_EFLOWSPEC = (WSABASEERR + 1017) ' An invalid or inconsistent flowspec was found in the QOS structure Public Const WSA_QOS_EPROVSPECBUF = (WSABASEERR + 1018) ' Invalid QOS provider-specific buffer Public Const WSA_QOS_EFILTERSTYLE = (WSABASEERR + 1019) ' An invalid QOS filter style was used Public Const WSA_QOS_EFILTERTYPE = (WSABASEERR + 1020) ' An invalid QOS filter type was used Public Const WSA_QOS_EFILTERCOUNT = (WSABASEERR + 1021) ' An incorrect number of QOS FILTERSPECs were specified in the FLOWDESCRIPTOR Public Const WSA_QOS_EOBJLENGTH = (WSABASEERR + 1022) ' An object with an invalid ObjectLength field was specified in the QOS provider-specific buffer Public Const WSA_QOS_EFLOWCOUNT = (WSABASEERR + 1023) ' An incorrect number of flow descriptors was specified in the QOS structure Public Const WSA_QOS_EUNKOWNPSOBJ = (WSABASEERR + 1024) ' An unrecognized object was found in the QOS provider-specific buffer Public Const WSA_QOS_EPOLICYOBJ = (WSABASEERR + 1025) ' An invalid policy object was found in the QOS provider-specific buffer Public Const WSA_QOS_EFLOWDESC = (WSABASEERR + 1026) ' An invalid QOS flow descriptor was found in the flow descriptor list Public Const WSA_QOS_EPSFLOWSPEC = (WSABASEERR + 1027) ' An invalid or inconsistent flowspec was found in the QOS provider-specific buffer Public Const WSA_QOS_EPSFILTERSPEC = (WSABASEERR + 1028) ' An invalid FILTERSPEC was found in the QOS provider-specific buffer Public Const WSA_QOS_ESDMODEOBJ = (WSABASEERR + 1029) ' An invalid shape discard mode object was found in the QOS provider-specific buffer Public Const WSA_QOS_ESHAPERATEOBJ = (WSABASEERR + 1030) ' An invalid shaping rate object was found in the QOS provider-specific buffer Public Const WSA_QOS_RESERVED_PETYPE = (WSABASEERR + 1031) ' A reserved policy element was found in the QOS provider-specific buffer ' Constants - Other Related Errors Public Const SOCKET_ERROR = (-1) ' Socket Error Public Const WSA_INVALID_HANDLE = 1609 ' Specified event object handle is invalid. (An application attempts to use an event object, but the specified handle is not valid) Public Const WSA_INVALID_PARAMETER = 87 ' One or more parameters are invalid. (An application used a Windows Sockets function which directly maps to a Win32 function. The Win32 function is indicating a problem with one or more parameters) Public Const WSA_IO_PENDING = 997 ' Overlapped operations will complete later. (The application has initiated an overlapped operation that cannot be completed immediately. A completion indication will be given later when the operation has been completed) Public Const WSA_NOT_ENOUGH_MEMORY = 8 ' Insufficient memory available. (An application used a Windows Sockets function that directly maps to a Win32 function. The Win32 function is indicating a lack of required memory resources) Public Const WSA_OPERATION_ABORTED = 995 ' Overlapped operation aborted. (An overlapped operation was canceled due to the closure of the socket, or the execution of the SIO_FLUSH command in WSAIoctl) '_____________________________________________________________________________________________________________ 'ŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻ ' Types - Win32 Related Public Type POINTAPI X As Long 'LONG // X axis coordinate Y As Long 'LONG // Y axis coordinate End Type Public Type MSG 'The MSG structure contains message information from a thread's message queue. hWnd As Long 'HWND // Handle to the window whose window procedure receives the message. Message As Long 'UINT // Specifies the message identifier. Applications can only use the low word; the high word is reserved by the system. wParam As Long 'WPARAM // Specifies additional information about the message. The exact meaning depends on the value of the message member. lParam As Long 'LPARAM // Specifies additional information about the message. The exact meaning depends on the value of the message member. Time As Long 'DWORD // Specifies the time at which the message was posted. PT As POINTAPI 'POINT // Specifies the cursor position, in screen coordinates, when the message was posted. End Type ' Constants - Win32 Related - PeekMessage.wRemoveMsg Public Const PM_REMOVE = &H1 ' Messages are removed from the queue after processing by PeekMessage. Public Const PM_NOREMOVE = &H0 ' Messages are not removed from the queue after processing by PeekMessage. ' Constants - Win32 Related - FormatMessage.dwFlags Public Const FORMAT_MESSAGE_ALLOCATE_BUFFER = &H100 ' Specifies that the lpBuffer parameter is a pointer to a PVOID pointer, and that the nSize parameter specifies the minimum number of TCHARs to allocate for an output message buffer. The function allocates a buffer large enough to hold the formatted message, and places a pointer to the allocated buffer at the address specified by lpBuffer. The caller should use the LocalFree function to free the buffer when it is no longer needed. Public Const FORMAT_MESSAGE_IGNORE_INSERTS = &H200 ' Specifies that insert sequences in the message definition are to be ignored and passed through to the output buffer unchanged. This flag is useful for fetching a message for later formatting. If this flag is set, the Arguments parameter is ignored. Public Const FORMAT_MESSAGE_FROM_STRING = &H400 ' Specifies that lpSource is a pointer to a null-terminated message definition. The message definition may contain insert sequences, just as the message text in a message table resource may. Cannot be used with FORMAT_MESSAGE_FROM_HMODULE or FORMAT_MESSAGE_FROM_SYSTEM. Public Const FORMAT_MESSAGE_FROM_HMODULE = &H800 ' Specifies that lpSource is a module handle containing the message-table resource(s) to search. If this lpSource handle is NULL, the current process's application image file will be searched. Cannot be used with FORMAT_MESSAGE_FROM_STRING. Public Const FORMAT_MESSAGE_FROM_SYSTEM = &H1000 ' Specifies that the function should search the system message-table resource(s) for the requested message. If this flag is specified with FORMAT_MESSAGE_FROM_HMODULE, the function searches the system message table if the message is not found in the module specified by lpSource. Cannot be used with FORMAT_MESSAGE_FROM_STRING. If this flag is specified, an application can pass the result of the GetLastError function to retrieve the message text for a system-defined error. Public Const FORMAT_MESSAGE_ARGUMENT_ARRAY = &H2000 ' Specifies that the Arguments parameter is not a va_list structure, but instead is just a pointer to an array of values that represent the arguments. ' General Win32 API Declarations Public Declare Sub CopyMemory Lib "KERNEL32" Alias "RtlMoveMemory" (Destination As Any, ByVal Source As Long, ByVal Length As Long) Public Declare Sub SetLastError Lib "KERNEL32" (ByVal dwErrCode As Long) Public Declare Function DispatchMessage Lib "USER32" Alias "DispatchMessageA" (ByRef lpMSG As MSG) As Long Public Declare Function FormatMessage Lib "KERNEL32" Alias "FormatMessageA" (ByVal dwFlags As Long, ByRef lpSource As Any, ByVal dwMessageId As Long, ByVal dwLanguageId As Long, ByVal lpBuffer As String, ByVal nSize As Long, ByRef Arguments As Long) As Long Public Declare Function GetLastError Lib "KERNEL32" () As Long Public Declare Function PeekMessage Lib "USER32" Alias "PeekMessageA" (ByRef lpMSG As MSG, ByVal hWnd As Long, ByVal wMsgFilterMin As Long, ByVal wMsgFilterMax As Long, ByVal wRemoveMsg As Long) As Long Public Declare Function StringFromPointer Lib "KERNEL32" Alias "lstrcpyA" (ByVal Return_String As String, ByVal StringPointer As Long) As Long Public Declare Function TranslateMessage Lib "USER32" (ByRef lpMSG As MSG) As Long '_____________________________________________________________________________________________________________ 'ŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻ 'XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX 'XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX 'XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX 'XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX 'XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX 'XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX 'XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX 'XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX 'XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX 'XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX 'XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX 'XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX 'XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX 'XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX 'XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX 'XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX 'XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX 'XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX 'XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX 'XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX 'XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX 'XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX 'XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX 'XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX '============================================================================================================= ' accept ' ' Minimum Availability : Windows Sockets 1.1 or later ' ' Description: ' ŻŻŻŻŻŻŻŻŻŻŻŻ ' The Windows Sockets accept function permits an incoming connection attempt on a socket. ' ' Parameters: ' ŻŻŻŻŻŻŻŻŻŻŻ ' s [in] Descriptor identifying a socket that has been placed in a listening state with the listen function. The connection is actually made with the socket that is returned by accept. ' addr [out] Optional pointer to a buffer that receives the address of the connecting entity, as known to the communications layer. The exact format of the addr parameter is determined by the address family that was established when the socket was created. ' addrlen [out] Optional pointer to an integer that contains the length of addr. ' ' Return: ' ŻŻŻŻŻŻŻ ' If no error occurs, accept returns a value of type SOCKET that is a descriptor for the new socket. This returned value is a handle for the socket on which the actual connection is made. ' Otherwise, a value of INVALID_SOCKET is returned, and a specific error code can be retrieved by calling WSAGetLastError. ' The integer referred to by addrlen initially contains the amount of space pointed to by addr. On return it will contain the actual length in bytes of the address returned. ' ____________________________________________________________________________________________________________ ' SOCKET accept (SOCKET s, struct sockaddr FAR *addr, int FAR *addrlen); '============================================================================================================= Public Declare Function accept Lib "WSOCK32.DLL" (ByVal hSocket As Long, ByRef SocketAddress As SOCKADDR, ByRef AddrLen As Long) As Long '============================================================================================================= ' AcceptEx ' ' Minimum Availability : Windows Sockets 1.1 or later (not supported on Windows 95/98) ' ' Description: ' ŻŻŻŻŻŻŻŻŻŻŻŻ ' The Windows Sockets AcceptEx function accepts a new connection, returns the local and remote address, and ' receives the first block of data sent by the client application. ' ' Note : This function is a Microsoft-specific extension to the Windows Sockets specification. For more ' information, see Microsoft Extensions and Windows Sockets 2. ' ' Parameters: ' ŻŻŻŻŻŻŻŻŻŻŻ ' sListenSocket [in] Descriptor identifying a socket that has already been called with the listen function. A server application waits for attempts to connect on this socket. ' sAcceptSocket [in] Descriptor identifying a socket on which to accept an incoming connection. This socket must not be bound or connected. ' lpOutputBuffer [in] Pointer to a buffer that receives the first block of data sent on a new connection, the local address of the server, and the remote address of the client. The receive data is written to the first part of the buffer starting at offset zero, while the addresses are written to the latter part of the buffer. If this parameter is set to NULL, no receive will be performed, nor will local or remote addresses be available through the use of GetAcceptExSockaddrs function calls. ' dwReceiveDataLength [in] Number of bytes in lpOutputBuffer that will be used for actual receive data at the beginning of the buffer. This size should not include the size of the local address of the server, nor the remote address of the client; they are appended to the output buffer. If dwReceiveDataLength is zero, accepting the connection will not result in a receive operation. Instead, AcceptEx completes as soon as a connection arrives, without waiting for any data. ' dwLocalAddressLength [in] Number of bytes reserved for the local address information. This value must be at least 16 bytes more than the maximum address length for the transport protocol in use. ' dwRemoteAddressLength [in] Number of bytes reserved for the remote address information. This value must be at least 16 bytes more than the maximum address length for the transport protocol in use. ' lpdwBytesReceived [out] Pointer to a DWORD that receives the count of bytes received. This parameter is set only if the operation completes synchronously. If it returns ERROR_IO_PENDING and is completed later, then this DWORD is never set and you must obtain the number of bytes read from the completion notification mechanism. ' lpOverlapped [in] An OVERLAPPED structure that is used to process the request. This parameter must be specified; it cannot be null. ' ' Return: ' ŻŻŻŻŻŻŻ ' If no error occurs, the AcceptEx function completed successfully and a value of TRUE is returned. ' If the function fails, AcceptEx returns FALSE. The WSAGetLastError function can then be called to ' return extended error information. If WSAGetLastError returns ERROR_IO_PENDING, then the operation ' was successfully initiated and is still in progress. ' ____________________________________________________________________________________________________________ ' BOOL AcceptEx (SOCKET sListenSocket, SOCKET sAcceptSocket, PVOID lpOutputBuffer, DWORD dwReceiveDataLength, DWORD dwLocalAddressLength, DWORD dwRemoteAddressLength, LPDWORD lpdwBytesReceived, lpOverlapped lpOverlapped); '============================================================================================================= Public Declare Function AcceptEx Lib "WSOCK32.DLL" (ByVal sListenSocket As Long, ByVal sAcceptSocket As Long, ByRef lpOutputBuffer As Any, ByVal dwReceiveDataLength As Long, ByVal dwLocalAddressLength As Long, ByVal dwRemoteAddressLength As Long, ByRef lpdwBytesReceived As Long, ByRef lpOverlapped As OVERLAPPED) As Long 'BOOL '============================================================================================================= ' bind ' ' Minimum Availability : Windows Sockets 1.1 or later ' ' Description: ' ŻŻŻŻŻŻŻŻŻŻŻŻ ' The Windows Sockets bind function associates a local address with a socket. ' ' Parameters: ' ŻŻŻŻŻŻŻŻŻŻŻ ' s [in] Descriptor identifying an unbound socket. ' name [in] Address to assign to the socket from the SOCKADDR structure. ' NameLen [in] Length of the value in the name parameter. ' ' Return: ' ŻŻŻŻŻŻŻ ' If no error occurs, bind returns zero. Otherwise, it returns SOCKET_ERROR, and a specific error code can be ' retrieved by calling WSAGetLastError. ' ____________________________________________________________________________________________________________ ' int bind (SOCKET s, const struct sockaddr FAR *name, int namelen); '============================================================================================================= Public Declare Function bind Lib "WSOCK32.DLL" (ByVal hSocket As Long, ByRef Name As SOCKADDR, ByVal NameLen As Long) As Long '============================================================================================================= ' closesocket ' ' Minimum Availability : Windows Sockets 1.1 or later ' ' Description: ' ŻŻŻŻŻŻŻŻŻŻŻŻ ' The Windows Sockets closesocket function closes an existing socket. ' ' Parameters: ' ŻŻŻŻŻŻŻŻŻŻŻ ' s [in] Descriptor identifying the socket to close. ' ' Return: ' ŻŻŻŻŻŻŻ ' If no error occurs, closesocket returns zero. Otherwise, a value of SOCKET_ERROR is returned, and a ' specific error code can be retrieved by calling WSAGetLastError. ' ____________________________________________________________________________________________________________ ' int closesocket (SOCKET s); '============================================================================================================= Public Declare Function closesocket Lib "WSOCK32.DLL" (ByVal hSocket As Long) As Long '============================================================================================================= ' connect ' ' Minimum Availability : Windows Sockets 1.1 or later ' ' Description: ' ŻŻŻŻŻŻŻŻŻŻŻŻ ' The Windows Sockets connect function establishes a connection to a specified socket. ' ' Parameters: ' ŻŻŻŻŻŻŻŻŻŻŻ ' s [in] Descriptor identifying an unconnected socket. ' name [in] Name of the socket to which the connection should be established. ' NameLen [in] Length of name. ' ' Return: ' ŻŻŻŻŻŻŻ ' If no error occurs, connect returns zero. Otherwise, it returns SOCKET_ERROR, and a specific error code ' can be retrieved by calling WSAGetLastError. ' ' On a blocking socket, the return value indicates success or failure of the connection attempt. ' ' With a nonblocking socket, the connection attempt cannot be completed immediately. In this case, connect ' will return SOCKET_ERROR, and WSAGetLastError will return WSAEWOULDBLOCK. In this case, there are three ' possible scenarios: ' - Use the select function to determine the completion of the connection request by checking to see if ' the socket is writeable. ' - If the application is using WSAAsyncSelect to indicate interest in connection events, then the ' application will receive an FD_CONNECT notification indicating that the connect operation is ' complete (successfully or not). ' - If the application is using WSAEventSelect to indicate interest in connection events, then the ' associated event object will be signaled indicating that the connect operation is complete ' (successfully or not). ' Until the connection attempt completes on a nonblocking socket, all subsequent calls to connect on the ' same socket will fail with the error code WSAEALREADY, and WSAEISCONN when the connection completes ' successfully. Due to ambiguities in version 1.1 of the Windows Sockets specification, error codes returned ' from connect while a connection is already pending may vary among implementations. As a result, it is not ' recommended that applications use multiple calls to connect to detect connection completion. If they do, ' they must be prepared to handle WSAEINVAL and WSAEWOULDBLOCK error values the same way that they handle ' WSAEALREADY, to assure robust execution. ' If the error code returned indicates the connection attempt failed (that is, WSAECONNREFUSED, ' SAENETUNREACH, WSAETIMEDOUT) the application can call connect again for the same socket. ' ____________________________________________________________________________________________________________ ' int connect (SOCKET s, const struct sockaddr FAR *name, int namelen); '============================================================================================================= Public Declare Function connect Lib "WSOCK32.DLL" (ByVal hSocket As Long, ByRef Name As SOCKADDR, ByVal NameLen As Long) As Long '============================================================================================================= ' EnumProtocols ' ' Minimum Availability : Windows Sockets 1.1 or later (Obsolete for Windows Sockets 2.0) ' ' Description: ' ŻŻŻŻŻŻŻŻŻŻŻŻ ' The EnumProtocols function obtains information about a specified set of network protocols that are active ' on a local host. ' ' Important: ' ŻŻŻŻŻŻŻŻŻŻ ' The EnumProtocols function is a Microsoft-specific extension to the Windows Sockets 1.1 specification. ' This function is obsolete. For the convenience of Windows Sockets 1.1 developers, the reference material ' is included. The WSAEnumProtocols function provides equivalent functionality in Windows Sockets 2. ' ' Parameters: ' ŻŻŻŻŻŻŻŻŻŻŻ ' lpiProtocols [in] Pointer to a null-terminated array of protocol identifiers. The EnumProtocols function obtains information about the protocols specified by this array. If lpiProtocols is NULL, the function obtains information about all available protocols. The following protocol identifier values are defined: IPPROTO_TCP, IPPROTO_UDP, ISOPROTO_TP4, NSPROTO_IPX, NSPROTO_SPX, NSPROTO_SPXII, ' lpProtocolBuffer [out] Pointer to a buffer that the function fills with an array of PROTOCOL_INFO data structures. ' lpdwBufferLength [in,out] Pointer to a variable that, on input, specifies the size, in bytes, of the buffer pointed to by lpProtocolBuffer. On output, the function sets this variable to the minimum buffer size needed to retrieve all of the requested information. For the function to succeed, the buffer must be at least this size. ' ' Return: ' ŻŻŻŻŻŻŻ ' If the function succeeds, the return value is the number of PROTOCOL_INFO data structures written to ' the buffer pointed to by lpProtocolBuffer. If the function fails, the return value is SOCKET_ERROR (–1). ' To get extended error information, call GetLastError. ' ____________________________________________________________________________________________________________ ' INT EnumProtocols (LPINT lpiProtocols, LPVOID lpProtocolBuffer, LPDWORD lpdwBufferLength); '============================================================================================================= Public Declare Function EnumProtocols Lib "WSOCK32.DLL" Alias "EnumProtocolsA" (ByVal lpiProtocols As Long, ByRef lpProtocolBuffer As PROTOCOL_INFO, ByRef lpdwBufferLength As Long) As Long '============================================================================================================= ' GetAcceptExSockaddrs ' ' Minimum Availability : Windows Sockets 1.1 or later ' ' Description: ' ŻŻŻŻŻŻŻŻŻŻŻŻ ' The Windows Sockets GetAcceptExSockaddrs function parses the data obtained from a call to the AcceptEx ' function and passes the local and remote addresses to a SOCKADDR structure. ' ' Note : This function is a Microsoft-specific extension to the Windows Sockets specification. For more ' information, see Microsoft Extensions and Windows Sockets 2. ' ' Parameters: ' ŻŻŻŻŻŻŻŻŻŻŻ ' lpOutputBuffer [in] Pointer to a buffer that receives the first block of data sent on a connection resulting from an AcceptEx call. Must be the same lpOutputBuffer parameter that was passed to the AcceptEx function. ' dwReceiveDataLength [in] Number of bytes in the buffer used for receiving the first data. This value must be equal to the dwReceiveDataLength parameter that was passed to the AcceptEx function. ' dwLocalAddressLength [in] Number of bytes reserved for the local address information. Must be equal to the dwLocalAddressLength parameter that was passed to the AcceptEx function. ' dwRemoteAddressLength [in] Number of bytes reserved for the remote address information. This value must be equal to the dwRemoteAddressLength parameter that was passed to the AcceptEx function. ' LocalSockaddr [out] Pointer to the SOCKADDR structure that receives the local address of the connection (the same information that would be returned by the Windows Sockets getsockname function). This parameter must be specified. ' LocalSockaddrLength [out] Size of the local address. This parameter must be specified. ' RemoteSockaddr [out] Pointer to the SOCKADDR structure that receives the remote address of the connection (the same information that would be returned by the Windows Sockets getpeername function). This parameter must be specified. ' RemoteSockaddrLength [out] Size of the local address. This parameter must be specified. ' ' Return: ' ŻŻŻŻŻŻŻ ' ( None ) ' ____________________________________________________________________________________________________________ ' VOID GetAcceptExSockaddrs (PVOID lpOutputBuffer, DWORD dwReceiveDataLength, DWORD dwLocalAddressLength, DWORD dwRemoteAddressLength, LPSOCKADDR *LocalSockaddr, LPINT LocalSockaddrLength, LPSOCKADDR *RemoteSockaddr, LPINT RemoteSockaddrLength); '============================================================================================================= Public Declare Sub GetAcceptExSockaddrs Lib "WSOCK32.DLL" (ByRef lpOutputBuffer As Any, ByVal dwReceiveDataLength As Long, ByVal dwLocalAddressLength As Long, ByVal dwRemoteAddressLength As Long, ByRef LocalSockaddr As SOCKADDR, ByRef LocalSockaddrLength As Long, ByRef RemoteSockaddr As SOCKADDR, ByRef RemoteSockaddrLength As Long) '============================================================================================================= ' GetAddressByName ' ' Minimum Availability : Requires Windows Sockets 1.1 (Obsolete for Windows Sockets 2.0) ' ' Description: ' ŻŻŻŻŻŻŻŻŻŻŻŻ ' The GetAddressByName function queries a name space, or a set of default name spaces, in order to obtain ' network address information for a specified network service. This process is known as service name resolution. ' A network service can also use the function to obtain local address information that it can use with the bind ' function. ' ' The functions detailed in Protocol-Independent Name Resolution provide equivalent functionality in Windows ' Sockets 2. ' ' Important : The GetAddressByName function is a Microsoft-specific extension to the Windows Sockets 1.1 ' specification. This function is obsolete. For the convenience of Windows Sockets 1.1 developers, the ' reference material is as follows. ' ' Parameters: ' ŻŻŻŻŻŻŻŻŻŻŻ ' dwNameSpace [in] Specifies the name space, or a set of default name spaces, that the operating system will query for network address information. Use one of the following constants to specify a name space: NS_DEFAULT, NS_DNS, NS_NETBT, NS_SAP, NS_TCPIP_HOSTS, NS_TCPIP_LOCAL ' Most calls to GetAddressByName should use the special value NS_DEFAULT. This lets a client get by with no knowledge of which name spaces are available on an internetwork. The system administrator determines name space access. Name spaces can come and go without the client having to be aware of the changes. ' lpServiceType [in] Pointer to a globally unique identifier (GUID) that specifies the type of the network service. The header file Svcguid.h includes definitions of several GUID service types, and macros for working with them. ' lpServiceName [in] Pointer to a zero-terminated string that uniquely represents the service name. For example, "MY SNA SERVER". Setting lpServiceName to NULL is the equivalent of setting dwResolution to RES_SERVICE. The function operates in its second mode, obtaining the local address to which a service of the specified type should bind. The function stores the local address within the LocalAddr member of the CSADDR_INFO structures stored into *lpCsaddrBuffer. ' If dwResolution is set to RES_SERVICE, the function ignores the lpServiceName parameter. ' If dwNameSpace is set to NS_DNS, *lpServiceName is the name of the host. ' lpiProtocols [in] Pointer to a zero-terminated array of protocol identifiers. The function restricts a name resolution attempt to name space providers that offer these protocols. This lets the caller limit the scope of the search. If lpiProtocols is NULL, the function obtains information on all available protocols. ' dwResolution [in] Set of bit flags that specify aspects of the service name resolution process. The following bit flags are defined: RES_SERVICE, RES_FIND_MULTIPLE, RES_SOFT_SEARCH ' lpServiceAsyncInfo [in] Reserved for future use; must be set to NULL. ' lpCsaddrBuffer [out] Pointer to a buffer to receive one or more CSADDR_INFO data structures. The number of structures written to the buffer depends on the amount of information found in the resolution attempt. You should assume that multiple structures will be written, although in many cases there will only be one. ' lpdwBufferLength [in,out] Pointer to a variable that, upon input, specifies the size, in bytes, of the buffer pointed to by lpCsaddrBuffer. Upon output, this variable contains the total number of bytes required to store the array of CSADDR_INFO structures. If this value is less than or equal to the input value of *lpdwBufferLength, and the function is successful, this is the number of bytes actually stored in the buffer. If this value is greater than the input value of *lpdwBufferLength, the buffer was too small, and the output value of *lpdwBufferLength is the minimal required buffer size. ' lpAliasBuffer [out] Pointer to a buffer to receive alias information for the network service. If a name space supports aliases, the function stores an array of zero-terminated name strings into the buffer pointed to by lpAliasBuffer. There is a double zero-terminator at the end of the list. The first name in the array is the service's primary name. Names that follow are aliases. An example of a name space that supports aliases is DNS. If a name space does not support aliases, it stores a double zero-terminator into the buffer. This parameter is optional, and can be set to NULL. ' lpdwAliasBufferLength [in,out] Pointer to a variable that, upon input, specifies the size, in bytes, of the buffer pointed to by lpAliasBuffer. Upon output, this variable contains the total number of bytes required to store the array of name strings. If this value is less than or equal to the input value of *lpdwAliasBufferLength, and the function is successful, this is the number of bytes actually stored in the buffer. If this value is greater than the input value of *lpdwAliasBufferLength, the buffer was too small, and the output value of *lpdwAliasBufferLength is the minimal required buffer size. If lpAliasBuffer is NULL, lpdwAliasBufferLength is meaningless and can also be NULL. ' ' Return: ' ŻŻŻŻŻŻŻ ' If the function succeeds, the return value is the number of CSADDR_INFO data structures written to the ' buffer pointed to by lpCsaddrBuffer. If the function fails, the return value is SOCKET_ERROR( – 1). ' To get extended error information, call GetLastError. ' ____________________________________________________________________________________________________________ ' INT GetAddressByName (DWORD dwNameSpace, LPGUID lpServiceType, LPTSTR lpServiceName, LPINT lpiProtocols, DWORD dwResolution, LPSERVICE_ASYNC_INFO lpServiceAsyncInfo, LPVOID lpCsaddrBuffer, LPDWORD lpdwBufferLength, LPTSTR lpAliasBuffer, LPDWORD lpdwAliasBufferLength); '============================================================================================================= Public Declare Function GetAddressByName Lib "WSOCK32.DLL" Alias "GetAddressByNameA" (ByVal dwNameSpace As Long, ByRef lpServiceType As GUID, ByVal lpServiceName As String, ByRef lpiProtocols As String, ByVal dwResolution As Long, ByVal Reserved As Long, ByRef lpCsaddrBuffer As CSADDR_INFO, ByRef lpdwBufferLength As Long, ByVal lpAliasBuffer As String, ByRef lpdwAliasBufferLength As Long) As Long '============================================================================================================= ' gethostbyaddr ' ' Minimum Availability : Windows Sockets 1.1 or later ' ' Description: ' ŻŻŻŻŻŻŻŻŻŻŻŻ ' The Windows Sockets gethostbyaddr function retrieves the host information corresponding to a network address. ' ' Parameters: ' ŻŻŻŻŻŻŻŻŻŻŻ ' addr [in] Pointer to an address in network byte order. ' len [in] Length of the address. ' type [in] Type of the address, such as the AF_INET address family type (defined as TCP, UDP, and other associated Internet protocols). Address family types and their corresponding values are defined in the winsock2.h header file. ' ' Return: ' ŻŻŻŻŻŻŻ ' If no error occurs, gethostbyaddr returns a pointer to the HOSTENT structure. Otherwise, it returns a ' NULL pointer, and a specific error code can be retrieved by calling WSAGetLastError. ' ____________________________________________________________________________________________________________ ' struct HOSTENT FAR * gethostbyaddr (const char FAR *addr, int len, int type); '============================================================================================================= Public Declare Function gethostbyaddr Lib "WSOCK32.DLL" (ByRef Address As Long, ByVal AddrLen As Long, ByVal AddrType As Long) As Long 'HOSTENT '============================================================================================================= ' gethostbyname ' ' Minimum Availability : Windows Sockets 1.1 or later ' ' Description: ' ŻŻŻŻŻŻŻŻŻŻŻŻ ' The Windows Sockets gethostbyname function retrieves host information corresponding to a host name from ' a host database. ' ' Parameters: ' ŻŻŻŻŻŻŻŻŻŻŻ ' name [out] Pointer to the null-terminated name of the host to resolve. ' ' Return: ' ŻŻŻŻŻŻŻ ' If no error occurs, gethostbyname returns a pointer to the HOSTENT structure described above. ' Otherwise, it returns a NULL pointer and a specific error number can be retrieved by calling WSAGetLastError. ' ____________________________________________________________________________________________________________ ' struct HOSTENT FAR *gethostbyname (const char FAR *name); '============================================================================================================= Public Declare Function gethostbyname Lib "WSOCK32.DLL" (ByVal Name As String) As Long 'HOSTENT '============================================================================================================= ' gethostname ' ' Minimum Availability : Windows Sockets 1.1 or later ' ' Description: ' ŻŻŻŻŻŻŻŻŻŻŻŻ ' The Windows Sockets gethostname function returns the standard host name for the local machine. ' ' Parameters: ' ŻŻŻŻŻŻŻŻŻŻŻ ' name [out] Pointer to a buffer that receives the local host name. ' NameLen [in] Length of the buffer. ' ' Return: ' ŻŻŻŻŻŻŻ ' If no error occurs, gethostname returns zero. Otherwise, it returns SOCKET_ERROR and a specific error code ' can be retrieved by calling WSAGetLastError. ' ____________________________________________________________________________________________________________ ' int gethostname (char FAR *name, int namelen); '============================================================================================================= Public Declare Function gethostname Lib "WSOCK32.DLL" (ByVal HostName As String, ByVal NameLen As Long) As Long '============================================================================================================= ' GetNameByType ' ' Minimum Availability : Windows Sockets 1.1 or later (Obsolete for Windows Sockets 2.0) ' ' Description: ' ŻŻŻŻŻŻŻŻŻŻŻŻ ' The GetNameByType function obtains the name of a network service. The network service is specified by its ' service type. ' Important : The GetNameByType function is a Microsoft-specific extension to the Windows Sockets 1.1 ' specification. This function is obsolete. For the convenience of Windows Sockets 1.1 developers, the ' reference material is as follows. ' The functions detailed in Protocol-Independent Name Resolution provide equivalent functionality in ' Windows Sockets 2. ' ' Parameters: ' ŻŻŻŻŻŻŻŻŻŻŻ ' lpServiceType [in] Pointer to a globally unique identifier (GUID) that specifies the type of the network service. The header file Svcguid.h includes definitions of several GUID service types, and macros for working with them. ' lpServiceName [out] Pointer to a buffer to receive a zero-terminated string that uniquely represents the name of the network service. ' dwNameLength [in,out] Pointer to a variable that, on input, specifies the size of the buffer pointed to by lpServiceName. On output, the variable contains the actual size of the service name string. ' ' Return: ' ŻŻŻŻŻŻŻ ' If the function succeeds, the return value is not SOCKET_ERROR ( –1). ' If the function fails, the return value is SOCKET_ERROR ( –1). To get extended error information, call GetLastError. ' ____________________________________________________________________________________________________________ ' INT GetNameByType (LPGUID lpServiceType, LPTSTR lpServiceName, DWORD dwNameLength); '============================================================================================================= Public Declare Function GetNameByType Lib "WSOCK32.DLL" Alias "GetNameByTypeA" (ByRef lpServiceType As GUID, ByVal lpServiceName As String, ByRef dwNameLength As Long) As Long '============================================================================================================= ' getpeername ' ' Minimum Availability : Windows Sockets 1.1 or later ' ' Description: ' ŻŻŻŻŻŻŻŻŻŻŻŻ ' The Windows Sockets getpeername function retrieves the name of the peer to which a socket is connected. ' ' Parameters: ' ŻŻŻŻŻŻŻŻŻŻŻ ' s [in] Descriptor identifying a connected socket. ' name [out] The structure that receives the name of the peer. ' NameLen [in, out] Pointer to the size of the name structure. ' ' Return: ' ŻŻŻŻŻŻŻ ' If no error occurs, getpeername returns zero. Otherwise, a value of SOCKET_ERROR is returned, and a ' specific error code can be retrieved by calling WSAGetLastError. ' ____________________________________________________________________________________________________________ ' int getpeername (SOCKET s, struct sockaddr FAR *name, int FAR *namelen); '============================================================================================================= Public Declare Function getpeername Lib "WSOCK32.DLL" (ByVal hSocket As Long, ByRef PearName As SOCKADDR, ByRef NameLen As Long) As Long '============================================================================================================= ' getprotobyname ' ' Minimum Availability : Windows Sockets 1.1 or later ' ' Description: ' ŻŻŻŻŻŻŻŻŻŻŻŻ ' The Windows Sockets getprotobyname function retrieves the protocol information corresponding to a protocol ' name. ' ' Parameters: ' ŻŻŻŻŻŻŻŻŻŻŻ ' name [in] Pointer to a null-terminated protocol name. ' ' Return: ' ŻŻŻŻŻŻŻ ' If no error occurs, getprotobyname returns a pointer to the PROTOENT. Otherwise, it returns a NULL ' pointer and a specific error number can be retrieved by calling WSAGetLastError. ' ____________________________________________________________________________________________________________ ' struct PROTOENT FAR * getprotobyname (const char FAR *name); '============================================================================================================= Public Declare Function getprotobyname Lib "WSOCK32.DLL" (ByVal Name As String) As Long 'As PROTOENT '============================================================================================================= ' getprotobynumber ' ' Minimum Availability : Windows Sockets 1.1 or later ' ' Description: ' ŻŻŻŻŻŻŻŻŻŻŻŻ ' The Windows Sockets getprotobynumber function retrieves protocol information corresponding to a protocol number. ' ' Parameters: ' ŻŻŻŻŻŻŻŻŻŻŻ ' number [in] Protocol number, in host byte order. ' ' Return: ' ŻŻŻŻŻŻŻ ' If no error occurs, getprotobynumber returns a pointer to the PROTOENT structure. Otherwise, it returns a ' NULL pointer and a specific error number can be retrieved by calling WSAGetLastError. ' ____________________________________________________________________________________________________________ ' struct PROTOENT FAR * getprotobynumber (int number); '============================================================================================================= Public Declare Function getprotobynumber Lib "WSOCK32.DLL" (ByVal Number As Long) As Long 'PROTOENT '============================================================================================================= ' getservbyname ' ' Minimum Availability : Windows Sockets 1.1 or later ' ' Description: ' ŻŻŻŻŻŻŻŻŻŻŻŻ ' The Windows Sockets getservbyname function retrieves service information corresponding to a service name ' and protocol. ' ' Parameters: ' ŻŻŻŻŻŻŻŻŻŻŻ ' name [in] Pointer to a null-terminated service name. ' proto [in] Optional pointer to a null-terminated protocol name. If this pointer is NULL, getservbyname returns the first service entry where name matches the s_name member of the SERVENT structure or the s_aliases member of the SERVENT structure. Otherwise, getservbyname matches both the name and the proto. ' ' Return: ' ŻŻŻŻŻŻŻ ' If no error occurs, getservbyname returns a pointer to the SERVENT structure. Otherwise, it returns a NULL ' pointer and a specific error number can be retrieved by calling WSAGetLastError. ' ____________________________________________________________________________________________________________ ' struct servent FAR * getservbyname (const char FAR *name, const char FAR *proto); '============================================================================================================= Public Declare Function getservbyname Lib "WSOCK32.DLL" (ByVal Name As String, ByVal Proto As String) As Long 'SERVENT '============================================================================================================= ' getservbyport ' ' Minimum Availability : Windows Sockets 1.1 or later ' ' Description: ' ŻŻŻŻŻŻŻŻŻŻŻŻ ' The Windows Sockets getservbyport function retrieves service information corresponding to a port and protocol. ' ' Parameters: ' ŻŻŻŻŻŻŻŻŻŻŻ ' port [in] Port for a service, in network byte order. ' Proto [in] Optional pointer to a protocol name. If this is NULL, getservbyport returns the first service entry for which the port matches the s_port of the SERVENT structure. Otherwise, getservbyport matches both the port and the proto parameters. ' ' Return: ' ŻŻŻŻŻŻŻ ' If no error occurs, getservbyport returns a pointer to the SERVENT structure. Otherwise, it returns a NULL ' pointer and a specific error number can be retrieved by calling WSAGetLastError. ' ____________________________________________________________________________________________________________ ' struct servent FAR * getservbyport (int port, const char FAR *proto); '============================================================================================================= Public Declare Function getservbyport Lib "WSOCK32.DLL" (ByVal Port As Long, ByVal Proto As String) As Long 'SERVENT '============================================================================================================= ' GetService ' ' Minimum Availability : Windows Sockets 1.1 or later (Obsolete for Windows Sockets 2.0) ' ' Description: ' ŻŻŻŻŻŻŻŻŻŻŻŻ ' The GetService function obtains information about a network service in the context of a set of default ' name spaces or a specified name space. The network service is specified by its type and name. The ' information about the service is obtained as a set of NS_SERVICE_INFO data structures. ' ' The functions detailed in Protocol-Independent Name Resolution provide equivalent functionality in Windows ' Sockets 2. ' ' Important : The GetService function is a Microsoft-specific extension to the Windows Sockets 1.1 ' specification. This function is obsolete. For the convenience of Windows Sockets 1.1 developers, the ' reference material is as follows. ' ' Parameters: ' ŻŻŻŻŻŻŻŻŻŻŻ ' dwNameSpace [in] Specifies the name space, or a set of default name spaces, that the operating system queries for information about the specified network service. Use one of the following constants to specify a name space: NS_DEFAULT, NS_DNS, NS_NETBT, NS_SAP, NS_TCPIP_HOSTS, NS_TCPIP_LOCAL ' Most calls to GetService should use the special value NS_DEFAULT. This lets a client get by without knowing available name spaces on an internetwork. The system administrator determines name space access. Name spaces can come and go without the client having to be aware of the changes. ' lpGuid [in] Pointer to a globally unique identifier (GUID) that specifies the type of the network service. The header file Svcguid.h includes GUID service types from many well-known services within the DNS and SAP name spaces. ' lpServiceName [in] Pointer to a zero-terminated string that uniquely represents the service name. For example, "MY SNA SERVER." ' dwProperties [in] Set of bit flags that specify the service information that the function obtains. Each of these bit flag constants, other than PROP_ALL, corresponds to a particular member of the SERVICE_INFO data structure. If the flag is set, the function puts information into the corresponding member of the data structures stored in *lpBuffer. The following bit flags are defined: PROP_COMMENT