JBSocket Class Reference

A Jabber streams's socket. More...

#include <yatejabber.h>

List of all members.

Public Member Functions

 JBSocket (JBEngine *engine, JBStream *stream, const char *address, int port)
 ~JBSocket ()
bool valid () const
const SocketAddraddr () const
const Stringerror () 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

Detailed Description

A Jabber streams's socket.

A socket used used to transport data for a Jabber stream


Constructor & Destructor Documentation

JBSocket ( JBEngine engine,
JBStream stream,
const char *  address,
int  port 
)

Constructor. Build socket for an outgoing stream

Parameters:
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


Member Function Documentation

const SocketAddr& addr (  )  const [inline]

Get the remote peer's address

Returns:
The remote peer's address
bool connect ( bool &  terminated,
const char *  newAddr,
int  newPort = 0 
)

Connect the socket

Parameters:
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
Returns:
False on failure
const String& error (  )  const [inline]

Get last connect/send/receive error text

Returns:
Last error text
bool recv ( char *  buffer,
unsigned int &  len 
)

Read data from socket

Parameters:
buffer Destination buffer
len The number of bytes to read. On exit contains the number of bytes actually read
Returns:
False on socket error
bool send ( const char *  buffer,
unsigned int &  len 
)

Write data to socket

Parameters:
buffer Source buffer
len The number of bytes to send
Returns:
False on socket error
void terminate ( bool  shutdown = false  ) 

Terminate the socket

Parameters:
shutdown True to shut down, false to asynchronously terminate the socket
bool valid (  )  const [inline]

Check if the socket is valid

Returns:
True if the socket is valid.

The documentation for this class was generated from the following file:
Generated on Thu Apr 8 18:19:43 2010 for Yate by  doxygen 1.6.3