David Fletcher / Mbed 2 deprecated cc3100_Test_websock_Camera_CM4F

Dependencies:   mbed

Embed: (wiki syntax)

« Back to documentation index

HttpSocket

HttpSocket

This module performs all HTTP socket operations. More...

Functions

int OpenTCPServerSocket (unsigned int uiPortNum)
 Creates a TCP socket and binds to it.
int CreateTCPServerSocket (unsigned int uiPortNum)
 Creates a TCP server socket.
int CloseTCPServerSocket (int iSockDesc)
 Closes TCP server socket.
int CreateTCPClientSocket (int iSockDesc)
 Accepts the client socket.
int CloseTCPClientSocket (int iSockDesc)
 Closes TCP client socket when the Http connection with that client is closed.
int ClientSocketSend (long socket, char *buffer, unsigned int len)
 Sends over the socket to a specific client.

Detailed Description

This module performs all HTTP socket operations.


Function Documentation

int ClientSocketSend ( long  socket,
char *  buffer,
unsigned int  len 
)

Sends over the socket to a specific client.

In non blocking socket type, it keeps looping till send is success

Parameters:
socketis the handle obtained from CreateTCPClientSocket buffer is the pointer to the data to be sent len is the length of the data to be sent

This function 1. Calls send and keeps trying as long as the return is SL_EAGAIN.

Returns:
length successfully sent if it was a success error code if there was a failure.

It will not return an error if simplelink returns SL_EAGAIN. Instead it will keep trying till it succeeds.

Definition at line 216 of file HttpSocket.cpp.

int CloseTCPClientSocket ( int  iSockDesc )

Closes TCP client socket when the Http connection with that client is closed.

Parameters:
iSockDescis the socket ID obtained from CreateTCPServerSocket

This function 1. Calls sl_close. Tries 3 times before returning error

Returns:
0 if success -1 if error

Definition at line 187 of file HttpSocket.cpp.

int CloseTCPServerSocket ( int  iSockDesc )

Closes TCP server socket.

Parameters:
iSockDescis the socket ID obtained from CreateTCPServerSocket

This function 1. Calls sl_close. Tries 3 times before returning error

Returns:
0 if success -1 if error

Definition at line 128 of file HttpSocket.cpp.

int CreateTCPClientSocket ( int  iSockDesc )

Accepts the client socket.

Sets it to blocking with receive timeout.

Parameters:
iSockDescis the socket ID obtained from CreateTCPServerSocket

This function 1. Accepts the client socket. 2. Sets to blocking mode with RECV timeout

Returns:
socket handler is returned after the SockID is put in listening state

Definition at line 156 of file HttpSocket.cpp.

int CreateTCPServerSocket ( unsigned int  uiPortNum )

Creates a TCP server socket.

It calls OpenTCPServerSocket.

Parameters:
uiPortNumis the port number to bind to

This function 1. Creates a TCP socket and binds to it 2. Sets the socket options

Returns:
Soceket Descriptor, < 1 if error.

Definition at line 98 of file HttpSocket.cpp.

int OpenTCPServerSocket ( unsigned int  uiPortNum )

Creates a TCP socket and binds to it.

Parameters:
uiPortNumis the port number to bind to

This function 1. Creates a TCP socket and binds to it

Returns:
Soceket Descriptor, < 1 if error.

Definition at line 36 of file HttpSocket.cpp.