NetServices Stack source

Dependents:   HelloWorld ServoInterfaceBoardExample1 4180_Lab4

Embed: (wiki syntax)

« Back to documentation index

UDPSocket Class Reference

UDPSocket Class Reference

This is a simple UDP Socket class. More...

#include <UDPSocket.h>

Public Member Functions

 UDPSocket ()
 Creates a new socket.
 ~UDPSocket ()
 Closes and destroys socket.
UDPSocketErr bind (const Host &me)
 Binds the socket to local host or a multicast address.
int sendto (const char *buf, int len, Host *pHost)
 Sends data.
int recvfrom (char *buf, int len, Host *pHost)
 Receives data.
UDPSocketErr close ()
 Closes socket.
void setOnEvent (void(*pMethod)(UDPSocketEvent))
 Setups callback.
template<class T >
void setOnEvent (T *pItem, void(T::*pMethod)(UDPSocketEvent))
 Setups callback.
void resetOnEvent ()
 Disables callback.

Detailed Description

This is a simple UDP Socket class.

This class exposes an API to deal with UDP Sockets

Definition at line 60 of file UDPSocket.h.


Constructor & Destructor Documentation

UDPSocket (  )

Creates a new socket.

Definition at line 27 of file UDPSocket.cpp.

~UDPSocket (  )

Closes and destroys socket.

Definition at line 32 of file UDPSocket.cpp.


Member Function Documentation

UDPSocketErr bind ( const Host me )

Binds the socket to local host or a multicast address.

Definition at line 37 of file UDPSocket.cpp.

UDPSocketErr close (  )

Closes socket.

Definition at line 61 of file UDPSocket.cpp.

int recvfrom ( char *  buf,
int  len,
Host pHost 
)

Receives data.

Definition at line 53 of file UDPSocket.cpp.

void resetOnEvent (  )

Disables callback.

Definition at line 87 of file UDPSocket.cpp.

int sendto ( const char *  buf,
int  len,
Host pHost 
)

Sends data.

Definition at line 45 of file UDPSocket.cpp.

void setOnEvent ( T *  pItem,
void(T::*)(UDPSocketEvent pMethod 
)

Setups callback.

Parameters:
pItem: instance of class on which to execute the callback method
pMethod: callback method

Definition at line 105 of file UDPSocket.h.

void setOnEvent ( void(*)(UDPSocketEvent pMethod )

Setups callback.

Parameters:
pMethod: callback function

Definition at line 73 of file UDPSocket.cpp.