If instead of using the fully specified handle type you use a more incomplete type, you allow your code to be used with all sockets which fulfill the minimal requirements of your code. These types are based on the ClientSocketHandle and ServerSocketHandle templates which implement the policy interface without providing the concrete protocol interface. To use those templates you may define a special reduced policy or handle for your code. By giving only an incomplete policy you thereby reduce the interface to that required by your module:
typedef ClientSocketHandle<
MakeSocketPolicy<
ReadablePolicy,
StreamFramingPolicy,
ConnectedCommunicationPolicy > > MyReadableHandle;
This defines MyReadableHandle
as a ClientSocketHandle which will have only read functionality. Your code expects a stream interface (in contrast to a packet or datagram based interface). You will not have write
or readfrom
members. write
will be disabled since the WritePolicy is unknown, readfrom
will be disabled since a socket with the ConnectedCommunicationPolicy does not have a readfrom
member.