SWUnixSocket(block_type block=blocking)Methods:
You can specify the blocking mode for this socket, see enum block_type for more information.
virtual bool bind(std::string path, SWBaseError *error = NULL)
Bind to a local socket file. The socket file pointed to in "path" will be created if it doesn't already exist. Note that the created socket file not will be deleted after use. Returns true on success. Possible error types: notConnected and fatal.
virtual bool connect(std::string path, SWBaseError *error = NULL)
Connect to an existing local socket file. Returns true on success. Possible error types: notConnected, noResponse, portInUse (socket file in use), notReady and fatal.
#include "SocketW.h" ... SWUnixSocket listener; SWUnixSocket *mySocket; listener.bind("/tmp/socketfile"); listener.listen(); mySocket = (SWUnixSocket *)listener.accept(); // do something with mySocket... mySocket->sendmsg("Hello Client!"); // disconnect and clean up mySocket->disconnect(); delete mySocket; |
#include "SocketW.h" ... SWUnixSocket mySocket; mySocket.connect("/tmp/socketfile"); // do something with mySocket... string msg = mySocket.recvmsg(); // disconnect mySocket.disconnect(); |
Copyright © 2003 Anders Lindström
Last updated 031024