Open Ephys GUI
 All Classes Functions Variables
Public Member Functions
UDPSocket Class Reference

#include <PracticalSocket.h>

Inheritance diagram for UDPSocket:
CommunicatingSocket Socket

List of all members.

Public Member Functions

 UDPSocket () throw (SocketException)
 UDPSocket (unsigned short localPort) throw (SocketException)
 UDPSocket (const string &localAddress, unsigned short localPort) throw (SocketException)
void disconnect () throw (SocketException)
void sendTo (const void *buffer, int bufferLen, const string &foreignAddress, unsigned short foreignPort) throw (SocketException)
int recvFrom (void *buffer, int bufferLen, string &sourceAddress, unsigned short &sourcePort) throw (SocketException)
void setMulticastTTL (unsigned char multicastTTL) throw (SocketException)
void joinGroup (const string &multicastGroup) throw (SocketException)
void leaveGroup (const string &multicastGroup) throw (SocketException)
- Public Member Functions inherited from CommunicatingSocket
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 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)

Additional Inherited Members

- Protected Member Functions inherited from CommunicatingSocket
 CommunicatingSocket (int type, int protocol) throw (SocketException)
 CommunicatingSocket (int newConnSD)
- Protected Member Functions inherited from Socket
 Socket (int type, int protocol) throw (SocketException)
 Socket (int sockDesc)

Detailed Description

UDP socket class


Constructor & Destructor Documentation

UDPSocket::UDPSocket ( ) throw (SocketException)

Construct a UDP socket

Exceptions:
SocketExceptionthrown if unable to create UDP socket
UDPSocket::UDPSocket ( unsigned short  localPort) throw (SocketException)

Construct a UDP socket with the given local port

Parameters:
localPortlocal port
Exceptions:
SocketExceptionthrown if unable to create UDP socket
UDPSocket::UDPSocket ( const string &  localAddress,
unsigned short  localPort 
) throw (SocketException)

Construct a UDP socket with the given local port and address

Parameters:
localAddresslocal address
localPortlocal port
Exceptions:
SocketExceptionthrown if unable to create UDP socket

Member Function Documentation

void UDPSocket::disconnect ( ) throw (SocketException)

Unset foreign address and port

Returns:
true if disassociation is successful
Exceptions:
SocketExceptionthrown if unable to disconnect UDP socket
void UDPSocket::joinGroup ( const string &  multicastGroup) throw (SocketException)

Join the specified multicast group

Parameters:
multicastGroupmulticast group address to join
Exceptions:
SocketExceptionthrown if unable to join group
void UDPSocket::leaveGroup ( const string &  multicastGroup) throw (SocketException)

Leave the specified multicast group

Parameters:
multicastGroupmulticast group address to leave
Exceptions:
SocketExceptionthrown if unable to leave group
int UDPSocket::recvFrom ( void *  buffer,
int  bufferLen,
string &  sourceAddress,
unsigned short &  sourcePort 
) throw (SocketException)

Read read up to bufferLen bytes data from this socket. The given buffer is where the data will be placed

Parameters:
bufferbuffer to receive data
bufferLenmaximum number of bytes to receive
sourceAddressaddress of datagram source
sourcePortport of data source
Returns:
number of bytes received and -1 for error
Exceptions:
SocketExceptionthrown if unable to receive datagram
void UDPSocket::sendTo ( const void *  buffer,
int  bufferLen,
const string &  foreignAddress,
unsigned short  foreignPort 
) throw (SocketException)

Send the given buffer as a UDP datagram to the specified address/port

Parameters:
bufferbuffer to be written
bufferLennumber of bytes to write
foreignAddressaddress (IP address or name) to send to
foreignPortport number to send to
Returns:
true if send is successful
Exceptions:
SocketExceptionthrown if unable to send datagram
void UDPSocket::setMulticastTTL ( unsigned char  multicastTTL) throw (SocketException)

Set the multicast TTL

Parameters:
multicastTTLmulticast TTL
Exceptions:
SocketExceptionthrown if unable to set TTL

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