Yate
|
A Jabber streams's socket. More...
#include <yatejabber.h>
Public Member Functions | |
JBSocket (JBEngine *engine, JBStream *stream, const char *address, int port) | |
~JBSocket () | |
bool | valid () const |
const SocketAddr & | addr () const |
const String & | error () const |
bool | connect (bool &terminated, const char *newAddr, int newPort=0) |
void | terminate (bool shutdown=false) |
bool | recv (char *buffer, unsigned int &len) |
bool | send (const char *buffer, unsigned int &len) |
Friends | |
class | JBStream |
A Jabber streams's socket.
A socket used used to transport data for a Jabber stream
Constructor. Build socket for an outgoing stream
engine | The Jabber engine |
stream | The stream owning this socket |
address | The address used to connect to |
port | Port used to connect to remote server |
~JBSocket | ( | ) | [inline] |
Destructor. Close the socket
const SocketAddr& addr | ( | ) | const [inline] |
Get the remote peer's address
bool connect | ( | bool & | terminated, |
const char * | newAddr, | ||
int | newPort = 0 |
||
) |
Connect the socket
terminated | True if false is returned and the socket was terminated while connecting |
newAddr | Optional address to connect to |
newPort | Optional port to connect to |
const String& error | ( | ) | const [inline] |
Get last connect/send/receive error text
bool recv | ( | char * | buffer, |
unsigned int & | len | ||
) |
Read data from socket
buffer | Destination buffer |
len | The number of bytes to read. On exit contains the number of bytes actually read |
bool send | ( | const char * | buffer, |
unsigned int & | len | ||
) |
Write data to socket
buffer | Source buffer |
len | The number of bytes to send |
void terminate | ( | bool | shutdown = false | ) |
Terminate the socket
shutdown | True to shut down, false to asynchronously terminate the socket |
bool valid | ( | ) | const [inline] |
Check if the socket is valid