Henry Leinen / WifiPlusClick

Dependents:   WifiPlusKlickExample

Embed: (wiki syntax)

« Back to documentation index

Socket Class Reference

Socket Class Reference

Class socket is the base class implementation for TCP and UDP sockets. More...

#include <Socket.h>

Inherited by TCPSocketConnection, TCPSocketServer, and UDPSocket.

Public Member Functions

 Socket ()
 Constructor of socket object.
void set_blocking (bool blocking, unsigned int timeout=1500)
 Function set_blocking sets the socket into a blocking or non-blocking status.
int set_option (int level, int optname, const void *optval, int socklen)
 Function set_option is not working as expected, because there this functionality is not supported by the WifiPlusClick module.
int close (bool shutdown=true)
 Function close will close the socket.

Detailed Description

Class socket is the base class implementation for TCP and UDP sockets.

As the socket class does not provide a full implementation of any kind, it is not recommended to use it. Class socket is required to implement the base functionality for UDP and TCP sockets in the WifiPlusClick library implementation.

Note:
Please note that in this implementation the set_option function is not working as the WifiPlusClick module does not support this functionality.

Definition at line 28 of file Socket.h.


Constructor & Destructor Documentation

Socket (  )

Constructor of socket object.

Definition at line 22 of file Socket.cpp.


Member Function Documentation

int close ( bool  shutdown = true )

Function close will close the socket.

Parameters:
shutdown: This parameter will actually be ignored by the implementation.
Returns:
: -1 if not successfull >=0 if successfull

Definition at line 38 of file Socket.cpp.

void set_blocking ( bool  blocking,
unsigned int  timeout = 1500 
)

Function set_blocking sets the socket into a blocking or non-blocking status.

In case of a blocking socket a timeout can be specified.

Parameters:
blocking: set to true if time consuming socket operations shall block execution until they are finished or until a timeout occurs. If set to false, socket operations will terminated immediately.
timeout: a timeout value in milliseconds for use in blocking operations.

Definition at line 31 of file Socket.cpp.

int set_option ( int  level,
int  optname,
const void *  optval,
int  socklen 
)

Function set_option is not working as expected, because there this functionality is not supported by the WifiPlusClick module.

Note:
This functionality is just kept for compatibility reasons.