C027 の mbes os 5 での動作を確認しました。 I confirmed the operation at mbes os 5 of C 027.

Fork of C027_Support by u-blox

Embed: (wiki syntax)

« Back to documentation index

TCPSocketConnection Class Reference

TCPSocketConnection Class Reference

TCP socket connection. More...

#include <TCPSocketConnection.h>

Inherits Socket.

Public Member Functions

 TCPSocketConnection ()
 TCP socket connection.
int connect (const char *host, const int port)
 Connects this TCP socket to the server.
bool is_connected (void)
 Check if the socket is connected.
int send (char *data, int length)
 Send data to the remote host.
int send_all (char *data, int length)
 Send all the data to the remote host.
int receive (char *data, int length)
 Receive data from the remote host.
int receive_all (char *data, int length)
 Receive all the data from the remote host.

Detailed Description

TCP socket connection.

Definition at line 8 of file TCPSocketConnection.h.


Constructor & Destructor Documentation

TCP socket connection.

Definition at line 15 of file TCPSocketConnection.h.


Member Function Documentation

int connect ( const char *  host,
const int  port 
)

Connects this TCP socket to the server.

Parameters:
hostThe host to connect to. It can either be an IP Address or a hostname that will be resolved with DNS.
portThe host's port to connect to.
Returns:
0 on success, -1 on failure.

Definition at line 22 of file TCPSocketConnection.h.

bool is_connected ( void   )

Check if the socket is connected.

Returns:
true if connected, false otherwise.

Definition at line 45 of file TCPSocketConnection.h.

int receive ( char *  data,
int  length 
)

Receive data from the remote host.

Parameters:
dataThe buffer in which to store the data received from the host.
lengthThe maximum length of the buffer.
Returns:
the number of received bytes on success (>=0) or -1 on failure

Definition at line 71 of file TCPSocketConnection.h.

int receive_all ( char *  data,
int  length 
)

Receive all the data from the remote host.

Parameters:
dataThe buffer in which to store the data received from the host.
lengthThe maximum length of the buffer.
Returns:
the number of received bytes on success (>=0) or -1 on failure

Definition at line 78 of file TCPSocketConnection.h.

int send ( char *  data,
int  length 
)

Send data to the remote host.

Parameters:
dataThe buffer to send to the host.
lengthThe length of the buffer to send.
Returns:
the number of written bytes on success (>=0) or -1 on failure

Definition at line 57 of file TCPSocketConnection.h.

int send_all ( char *  data,
int  length 
)

Send all the data to the remote host.

Parameters:
dataThe buffer to send to the host.
lengthThe length of the buffer to send.
Returns:
the number of written bytes on success (>=0) or -1 on failure

Definition at line 64 of file TCPSocketConnection.h.