A socket type represents the type of communication channel for which a socket serves as an endpoint.
The Networking package sets defaults for these types, so you might not need to read this section.
A socket's type has three components:
Family
A socket family indicates which protocol and address family is used with this socket. The family may be represented with either an integer constant or a string. A sample family and the associated integer and string identifiers are shown below.
Family |
Integer identifier |
String identifier |
Internet |
AF_INET |
"inet" |
The only family fully implemented in the Networking package is the Internet protocol family. However, you can add your own address families.
Type
The communication semantics of the channel are indicated through an integer type, as shown below. The Networking package does not support all types.
Type |
Integer identifier |
String identifier |
Datagram socket |
SOCK_DGRAM |
"dgram" |
Stream socket |
SOCK_STREAM |
"stream" |
Protocol
The protocol specifies a specific protocol to be used by the channel. Generally only experts need this feature. The protocol indicated by the family and type of the socket is all that is necessary. The specific values allowed for the protocol vary.
In the Networking package, a socket address type is represented by an RWSockType object. This is a concrete class that does not have virtual functions, but does have copying and assignment semantics. The RWInetType class can be used to construct an RWSockType for the Internet family of classes. Because RWSockType is a concrete class, these derived classes can be converted to instances of RWSockType with no change in the semantics of the object.
Copyright © Rogue Wave Software, Inc. All Rights Reserved.
The Rogue Wave name and logo, and SourcePro, are registered trademarks of Rogue Wave Software. All other trademarks are the property of their respective owners.
Provide feedback to Rogue Wave about its documentation.