Rudiments
|
Inherits socketlayer.
Public Member Functions | |
websocket () | |
virtual | ~websocket () |
void | setFileDescriptor (filedescriptor *fd) |
filedescriptor * | getFileDescriptor () |
bool | connect () |
bool | accept () |
ssize_t | read (void *buf, size_t size) |
ssize_t | write (const void *buf, size_t size) |
bool | ping (const byte_t *buf, size_t size) |
size_t | getPendingSize () |
bool | close () |
size_t | getSizeMax () |
Public Member Functions inherited from object | |
virtual | ~object () |
The websocket class implements the socketlayer interface for Web Sockets.
websocket::websocket | ( | ) |
Creates a new instance of the websocket class.
|
virtual |
Deletes this instance of the websocket class.
bool websocket::accept | ( | ) |
Accepts a security context from the client with whom a connection is already established across the filedescriptor previously set using setFileDescriptor().
Note that if this instance is set as the current GSS context of a child of the socketserver class, then this method is called implicitly during a successful call to accept().
Returns true on success and false on failure.
bool websocket::close | ( | ) |
bool websocket::connect | ( | ) |
Initiates a security context with the server with whom a connection is already established across the filedescriptor previously set using setFileDescriptor().
Note that if this instance is set as the current security context of a child of the socketclient class, then this method is called implicitly during a successful call to connect().
Returns true on success and false on failure.
|
virtual |
Returns the file descrptor that will be used to communicate with the peer during the next call to connect() or accept().
Implements socketlayer.
size_t websocket::getPendingSize | ( | ) |
Returns the number of bytes that are buffered and available for immediate read.
size_t websocket::getSizeMax | ( | ) |
bool websocket::ping | ( | const byte_t * | buf, |
size_t | size | ||
) |
Pings the peer with "size" bytes of "buf" data. Returns true if the peer responds with the same data or false if the peer doesn't respond or responds with different data.
ssize_t websocket::read | ( | void * | buf, |
size_t | size | ||
) |
Reads from the file descriptor previously configured by setFileDescriptor() into "buf" until "size" bytes have been read. Returns the number of bytes that were written to "buf" or RESULT_ERROR if an error occurred.
|
virtual |
Sets the file descriptor that will be used to communicate with the peer during the next call to connect() or accept().
Implements socketlayer.
ssize_t websocket::write | ( | const void * | buf, |
size_t | size | ||
) |
Writes "size" bytes from "buf" to the file descriptor previously configured by setFileDescriptor(). Returns the number of bytes that were written or RESULT_ERROR if an error occurred.