Windows* Sockets 2 Application Programming Interface An Interface for Transparent Network Programming Under Microsoft Windowstm revision 2 August 7, 1997


Extended Byte Order Conversion Routines



Download 1.64 Mb.
Page8/49
Date31.07.2017
Size1.64 Mb.
#24975
1   ...   4   5   6   7   8   9   10   11   ...   49

37 Extended Byte Order Conversion Routines


WinSock 2 does not assume that the network byte order for all protocols is the same. Therefore a set of conversion routines are supplied for converting 16 and 32 bit quantities to and from network byte order. These routines take as an input parameter the socket handle, which has a WSAPROTOCOL_INFO structure associated with it. The NetworkByteOrder field in the WSAPROTOCOL_INFO structure specifies what the desired network byte order is (currently either “big-endian” or “little-endian”)..

38 Support for Scatter/Gather I/O


The WSASend(), WSASendTo(), WSARecv(), and WSARecvFrom() routines all take an array of application buffers as input parameters and thus may be used for scatter/gather (or vectored) I/O. This can be very useful in instances where portions of each message being transmitted consist of one or more fixed length “header” components in addition to message body. Such header components need not be concatenated by the application into a single contiguous buffer prior to sending. Likewise on receiving, the header components can be automatically split off into separate buffers, leaving the message body “pure”.
When receiving into multiple buffers, completion occurs as data arrives from the network, regardless of whether all of the supplied buffers are utilized.

39 Protocol-Independent Multicast and Multipoint


Just as WinSock 2 allows the basic data transport capabilities of numerous transport protocols to be accessed in a generic manner, it also provides a generic way to utilize multipoint and multicast capabilities of transports that implement these features. To simplify, the term multipoint is used hereafter to refer to both multicast and multipoint communications.
Current multipoint implementations (e.g. IP multicast, ST-II, T.120, ATM UNI, etc.) vary widely with respect to how nodes join a multipoint session, whether a particular node is designated as a central or root node, and whether data is exchanged between all nodes or only between a root node and the various leaf nodes. WinSock 2’s WSAPROTOCOL_INFO struct is used to declare the various multipoint attributes of a protocol. By examining these attributes the programmer will know what conventions to follow with the applicable WinSock 2 functions to setup, utilize and teardown multipoint sessions.
The features of WinSock 2 that support multicast can be summarized as follows:

  • Two attribute bits in the WSAPROTOCOL_INFO struct

  • Four flags defined for the dwFlags parameter of WSASocket()

  • One function, WSAJoinLeaf(), for adding leaf nodes into a multipoint session

  • Two WSAIoctl() command codes for controlling multipoint loopback and establishing the scope for multicast transmissions. (The latter corresponds to the IP multicast time-to-live or TTL parameter.)

Note that the inclusion of these multipoint features in WinSock 2 does not preclude an application from using an existing protocol-dependent interface, such as the Deering socket options for IP multicast (as described in the TCP/IP section of the Windows Sockets 2 Protocol-Specific Annex).


Please refer to Appendix B. Multipoint and Multicast Semantics for detailed information on how the various multipoint schemes are characterized and how the applicable features of WinSock 2 are utilized.

40 Summary of New Socket Options


The new socket options for Winsock 2 are summarized in the following table. More detailed information is provided in section 3 under getsockopt() and/or setsockopt(). There are other new protocol-specific socket options which can be found in the protocol-specific annex.


Value

Type

Meaning

Default

Note

SO_GROUP_ID

GROUP

Reserved for future use with socket groups: The identifier of the group to which this socket belongs.

NULL

get only

SO_GROUP_PRIORITY

int

Reserved for future use with socket groups: The relative priority for sockets that are part of a socket group.

0




SO_MAX_MSG_SIZE

int

Maximum outbound (send) size of a message for message-oriented socket types. There is no provision for finding out the maximum inbound message size. Has no meaning for stream-oriented sockets.

Implementation dependent

get only

SO_PROTOCOL_INFO

struct WSAPROTOCOL_INFO

Description of protocol info for protocol that is bound to this socket.

protocol dependent

get only

PVD_CONFIG

char FAR *

An opaque data structure object containing configuration information of the service provider.

Implementation dependent






41 Summary of New Socket Ioctl Opcodes


The new socket ioctl opcodes for Winsock 2 are summarized in the following table. More detailed information is provided in section 3 under WSAIoctl(). Note that WSAIoctl() also supports all the ioctl opcodes specified in ioctlsocket(). There are other new protocol-specific ioctl opcodes which can be found in the protocol-specific annex.


Opcode

Input Type

Output Type

Meaning

SIO_ASSOCIATE_HANDLE

companion API dependent



Associate the socket with the specified handle of a companion interface.

SIO_ENABLE_CIRCULAR_QUEUEING





Circular queuing is enabled.

SIO_FIND_ROUTE

struct sockaddr



Request the route to the specified address to be discovered.

SIO_FLUSH





Discard current contents of the sending queue.

SIO_GET_BROADCAST_ADDRESS



struct sockaddr

Retrieve the protocol-specific broadcast address to be used in sendto()/WSASendTo()

SIO_GET_QOS



QOS

Retrieve current flow spec(s) for the socket.

SIO_GET_GROUP_QOS



QOS

Reserved for future use with socket groups: Retrieve current group flow spec(s) for the group this socket belongs to.

SIO_MULTIPOINT_LOOPBACK

BOOL



Control whether data sent in a multipoint session will also be received by the same socket on the local host.

SIO_MULTICAST_SCOPE

int



Specify the scope over which multicast transmissions will occur.

SIO_SET_QOS

QOS



Establish new flow spec(s) for the socket.

SIO_SET_GROUP_QOS

QOS



Reserved for future use with socket groups: Establish new group flow spec(s) for the group this socket belongs to.

SIO_TRANSLATE_HANDLE

int

companion API dependent

Obtain a corresponding handle for socket s that is valid in the context of a companion interface.

SIO_ROUTING_INTERFACE_QUERY

SOCKADDR

SOCKADDR

Obtain the address of local interface which should be used to send to the specified address

SIO_ROUTING_INTERFACE_CHANGE

SOCKADDR



Request notification of changes in information reported via SIO_ROUTING_INTERFACE_QUERY for the specified address

SIO_ADDRESS_LIST_QUERY



SOCKET_ADDRESS_LIST

Obtain the list of addresses to which application can bind.

SIO_ADDRESS_LIST_CHANGE





Request notification of changes in information reported via SIO_ADDRESS_LIST_QUERY




Download 1.64 Mb.

Share with your friends:
1   ...   4   5   6   7   8   9   10   11   ...   49




The database is protected by copyright ©ininet.org 2024
send message

    Main page