Vault
4.1
|
The Vault implements platform-independent sockets, for both clients and servers. More...
Classes | |
class | VNetworkInterfaceInfo |
VNetworkInterfaceInfo describes an Internet interface on this computer. More... | |
class | VSocketFactory |
VSocketFactory can be used as-is, or can be subclassed to create special kinds of sockets; normally every socket is just a VSocket, but it is conceivable to have things like VSecureSocket or such. More... | |
class | VSocketStream |
VSocketStream is a concrete VStream class that knows how to do i/o on a VSocket. More... | |
class | VSocketThread |
VSocketThread is an abstract base class, derived from VThread, that has both a VSocket, on which it presumably communicates with a client, and an owner VThread, which is presumably the VListenerThread that it. More... | |
class | VListenerSocket |
VListenerSocket is a special kind of socket that can accept incoming connections and create a new VSocket for each such connection that it accepts. More... | |
class | VListenerThread |
A VListenerThread is a thread whose run() method listens on a socket and creates a new VSocket for each incoming connection and a VSocketThread object to manage each such VSocket. More... | |
class | VMessageInputThread |
VMessageInputThread understands how to perform blocking input reads of VMessage objects (finding and calling a VMessageHandler) from its i/o stream. More... | |
class | VMessageOutputThread |
VMessageOutputThread understands how to maintain and monitor a message output queue, waking up when a new message has been posted to the queue, and writing it to the output stream. More... | |
class | VMessageQueue |
VMessageQueue is a thread-safe FIFO queue of messages. More... |
The Vault implements platform-independent sockets, for both clients and servers.
The class VSocket defines the low-level API for dealing with sockets. It's low-level in the sense that most Vault users will not have to use this API other than calling connectToHostName() or connectToIPAddress() to connect the socket when implementing a client-side connection. Instead, you'll mostly be using classes like VSocketStream to associate a stream with a socket, and the upper layer stream classes to perform the actual socket i/o. And server implementors will similarly just be attaching a stream object to each socket that gets created for an incoming client connection.
Each socket platform (BSD/Unix sockets, or Winsock) has a slightly different API, but they are very close. The platform-specific quirks are separated out in the vsocket_platform.h and .cpp files per-platform.
Client code that needs to connect will instantiate a VSocket, and then presumably use a VSocketStream and a VIOStream to do i/o over the socket. Server code will typically create a VListenerThread, which will use a VListenerSocket, and turn each incoming connection into a VSocket and VSocketThread, both created via a factory that you can supply to define the concrete classes that are instantiated for each. There are related classes for server-side client session/thread/socket/io management that you will find very helpful, located in the server directory: key classes are VServer, VClientSession, and related classes for messages, message queues, and i/o threads.