Dependents:   SNMPAgent HTTPServer think_speak_a cyassl-client ... more

Embed: (wiki syntax)

« Back to documentation index

TCPSocket Class Reference

TCPSocket Class Reference

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

#include <TCPSocket.h>

Public Member Functions

 TCPSocket ()
 Creates a new socket.
 ~TCPSocket ()
 Closes if needed and destroys the socket.
TCPSocketErr bind (const Host &me)
 Binds the socket to (local) host.
TCPSocketErr listen ()
 Starts listening.
TCPSocketErr connect (const Host &host)
 Connects socket to host.
TCPSocketErr accept (Host *pClient, TCPSocket **ppNewTcpSocket)
 Accepts connection from client and gets connected socket.
int send (const char *buf, int len)
 Sends data.
int recv (char *buf, int len)
 Receives data.
TCPSocketErr close ()
 Closes socket.
void setOnEvent (void(*pMethod)(TCPSocketEvent))
 Setups callback.
template<class T >
void setOnEvent (T *pItem, void(T::*pMethod)(TCPSocketEvent))
 Setups callback.
void resetOnEvent ()
 Disables callback.
 TCPSocket ()
 Creates a new socket.
 ~TCPSocket ()
 Closes if needed and destroys the socket.
TCPSocketErr bind (const Host &me)
 Binds the socket to (local) host.
TCPSocketErr listen ()
 Starts listening.
TCPSocketErr connect (const Host &host)
 Connects socket to host.
TCPSocketErr accept (Host *pClient, TCPSocket **ppNewTcpSocket)
 Accepts connection from client and gets connected socket.
int send (const char *buf, int len)
 Sends data.
int recv (char *buf, int len)
 Receives data.
TCPSocketErr close ()
 Closes socket.
void setOnEvent (void(*pMethod)(TCPSocketEvent))
 Setups callback.
template<class T >
void setOnEvent (T *pItem, void(T::*pMethod)(TCPSocketEvent))
 Setups callback.
void resetOnEvent ()
 Disables callback.

Detailed Description

This is a simple TCP Socket class.

This class exposes an API to deal with TCP Sockets

Definition at line 71 of file LPC1768/api/TCPSocket.h.


Constructor & Destructor Documentation

TCPSocket (  )

Creates a new socket.

~TCPSocket (  )

Closes if needed and destroys the socket.

TCPSocket (  )

Creates a new socket.

~TCPSocket (  )

Closes if needed and destroys the socket.


Member Function Documentation

TCPSocketErr accept ( Host pClient,
TCPSocket **  ppNewTcpSocket 
)

Accepts connection from client and gets connected socket.

TCPSocketErr accept ( Host pClient,
TCPSocket **  ppNewTcpSocket 
)

Accepts connection from client and gets connected socket.

TCPSocketErr bind ( const Host me )

Binds the socket to (local) host.

TCPSocketErr bind ( const Host me )

Binds the socket to (local) host.

TCPSocketErr close (  )

Closes socket.

TCPSocketErr close (  )

Closes socket.

TCPSocketErr connect ( const Host host )

Connects socket to host.

TCPSocketErr connect ( const Host host )

Connects socket to host.

TCPSocketErr listen (  )

Starts listening.

TCPSocketErr listen (  )

Starts listening.

int recv ( char *  buf,
int  len 
)

Receives data.

int recv ( char *  buf,
int  len 
)

Receives data.

void resetOnEvent (  )

Disables callback.

void resetOnEvent (  )

Disables callback.

int send ( const char *  buf,
int  len 
)

Sends data.

int send ( const char *  buf,
int  len 
)

Sends data.

void setOnEvent ( void(*)(TCPSocketEvent pMethod )

Setups callback.

Parameters:
pMethod: callback function
void setOnEvent ( T *  pItem,
void(T::*)(TCPSocketEvent pMethod 
)

Setups callback.

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

Definition at line 125 of file LPC2368/api/TCPSocket.h.

void setOnEvent ( void(*)(TCPSocketEvent pMethod )

Setups callback.

Parameters:
pMethod: callback function
void setOnEvent ( T *  pItem,
void(T::*)(TCPSocketEvent pMethod 
)

Setups callback.

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

Definition at line 125 of file LPC1768/api/TCPSocket.h.