Ginga  0.13.6
 All Classes Namespaces Functions Variables
Public Member Functions | Protected Member Functions | List of all members
br::pucrio::telemidia::ginga::core::system::compat::CommunicatingSocket Class Reference

#include <PracticalSocket.h>

Inheritance diagram for br::pucrio::telemidia::ginga::core::system::compat::CommunicatingSocket:
Inheritance graph
[legend]
Collaboration diagram for br::pucrio::telemidia::ginga::core::system::compat::CommunicatingSocket:
Collaboration graph
[legend]

Public Member Functions

void connect (const string &foreignAddress, unsigned short foreignPort) throw (SocketException)
 
void send (const void *buffer, int bufferLen) throw (SocketException)
 
int recv (void *buffer, int bufferLen) throw (SocketException)
 
string getForeignAddress () throw (SocketException)
 
unsigned short getForeignPort () throw (SocketException)
 
- Public Member Functions inherited from br::pucrio::telemidia::ginga::core::system::compat::Socket
 ~Socket ()
 
string getLocalAddress () throw (SocketException)
 
unsigned short getLocalPort () throw (SocketException)
 
void setLocalPort (unsigned short localPort) throw (SocketException)
 
void setLocalAddressAndPort (const string &localAddress, unsigned short localPort=0) throw (SocketException)
 

Protected Member Functions

 CommunicatingSocket (int type, int protocol) throw (SocketException)
 
 CommunicatingSocket (int newConnSD)
 
- Protected Member Functions inherited from br::pucrio::telemidia::ginga::core::system::compat::Socket
 Socket (int type, int protocol) throw (SocketException)
 
 Socket (int sockDesc)
 

Additional Inherited Members

- Static Public Member Functions inherited from br::pucrio::telemidia::ginga::core::system::compat::Socket
static void cleanUp () throw (SocketException)
 
static unsigned short resolveService (const string &service, const string &protocol="tcp")
 
- Protected Attributes inherited from br::pucrio::telemidia::ginga::core::system::compat::Socket
int sockDesc
 

Detailed Description

Socket which is able to connect, send, and receive

Member Function Documentation

void br::pucrio::telemidia::ginga::core::system::compat::CommunicatingSocket::connect ( const string &  foreignAddress,
unsigned short  foreignPort 
)
throw (SocketException
)

Establish a socket connection with the given foreign address and port

Parameters
foreignAddressforeign address (IP address or name)
foreignPortforeign port
Exceptions
SocketExceptionthrown if unable to establish connection
string br::pucrio::telemidia::ginga::core::system::compat::CommunicatingSocket::getForeignAddress ( )
throw (SocketException
)

Get the foreign address. Call connect() before calling recv()

Returns
foreign address
Exceptions
SocketExceptionthrown if unable to fetch foreign address
unsigned short br::pucrio::telemidia::ginga::core::system::compat::CommunicatingSocket::getForeignPort ( )
throw (SocketException
)

Get the foreign port. Call connect() before calling recv()

Returns
foreign port
Exceptions
SocketExceptionthrown if unable to fetch foreign port
int br::pucrio::telemidia::ginga::core::system::compat::CommunicatingSocket::recv ( void *  buffer,
int  bufferLen 
)
throw (SocketException
)

Read into the given buffer up to bufferLen bytes data from this socket. Call connect() before calling recv()

Parameters
bufferbuffer to receive the data
bufferLenmaximum number of bytes to read into buffer
Returns
number of bytes read, 0 for EOF, and -1 for error
Exceptions
SocketExceptionthrown if unable to receive data
void br::pucrio::telemidia::ginga::core::system::compat::CommunicatingSocket::send ( const void *  buffer,
int  bufferLen 
)
throw (SocketException
)

Write the given buffer to this socket. Call connect() before calling send()

Parameters
bufferbuffer to be written
bufferLennumber of bytes from buffer to be written
Exceptions
SocketExceptionthrown if unable to send data

The documentation for this class was generated from the following files: