cisst-saw
|
Declaration of osaSocketThis is a cross-platform socket library with basic support for UDP (datagram) and TCP (stream) sockets. The BSD socket API is used on Unix-like systems, while the Winsock2 API is used on Windows. More...
#include <cisstCommon/cmnAssert.h>
#include <cisstCommon/cmnGenericObject.h>
#include <cisstCommon/cmnLogger.h>
#include <cisstCommon/cmnPortability.h>
#include <cisstOSAbstraction/osaExport.h>
Go to the source code of this file.
Classes | |
struct | osaIPandPort |
class | osaSocket |
Functions | |
CMN_DECLARE_SERVICES_INSTANTIATION (osaSocket) | |
Declaration of osaSocket
This is a cross-platform socket library with basic support for UDP (datagram) and TCP (stream) sockets. The BSD socket API is used on Unix-like systems, while the Winsock2 API is used on Windows.
For UDP, both a server and client can be defined and set as follows:
where serverHost could either be the hostname or the IP address of the server. UDP sockets update their destination to the origin of the last message received.
For the TCP case, the client has to additionally call the Connect() method, while the server is created using the osaSocketServer class.
The TCP server is defined using osaSocketServer, which calls an overloaded osaSocket constructor upon accepting a connection (see osaSocketServer class).
CMN_DECLARE_SERVICES_INSTANTIATION | ( | osaSocket | ) |