 |
F´ Flight Software - C/C++ Documentation
NASA-v2.0.1
A framework for building embedded system applications to NASA flight quality standards.
|
Go to the documentation of this file.
17 #ifdef TGT_OS_TYPE_VXWORKS
29 #elif defined TGT_OS_TYPE_LINUX || TGT_OS_TYPE_DARWIN
30 #include <sys/socket.h>
32 #include <arpa/inet.h>
34 #error OS not supported for IP Socket Communications
46 struct sockaddr_in address;
49 if ((socketFd = ::socket(AF_INET, SOCK_STREAM, 0)) == -1) {
53 address.sin_family = AF_INET;
54 address.sin_port = htons(this->
m_port);
57 #if defined TGT_OS_TYPE_VXWORKS || TGT_OS_TYPE_DARWIN
58 address.sin_len =
static_cast<U8>(
sizeof(
struct sockaddr_in));
74 if (::connect(socketFd,
reinterpret_cast<struct sockaddr*
>(&address),
sizeof(address)) < 0) {
@ SOCK_SUCCESS
Socket operation successful.
@ SOCK_FAILED_TO_SET_SOCKET_OPTIONS
Failed to configure socket.
SocketIpStatus setupTimeouts(NATIVE_INT_TYPE socketFd)
setup the socket timeout properties of the opened outgoing socket
uint8_t U8
8-bit unsigned integer
@ SOCK_FAILED_TO_CONNECT
Failed to connect socket.
TcpClientSocket()
Constructor for client socket tcp implementation.
Helper base-class for setting up Berkley sockets.
@ SOCK_INVALID_IP_ADDRESS
Bad IP address supplied.
char m_hostname[SOCKET_MAX_HOSTNAME_SIZE]
Hostname to supply.
I32 sendProtocol(const U8 *const data, const U32 size)
Protocol specific implementation of send. Called directly with retry from send.
@ SOCK_FAILED_TO_GET_SOCKET
Socket open failed.
SocketIpStatus openProtocol(NATIVE_INT_TYPE &fd)
Tcp specific implementation for opening a client socket.
static void logMsg(const char *fmt, POINTER_CAST a0=0, POINTER_CAST a1=0, POINTER_CAST a2=0, POINTER_CAST a3=0, POINTER_CAST a4=0, POINTER_CAST a5=0, POINTER_CAST a6=0, POINTER_CAST a7=0, POINTER_CAST a8=0, POINTER_CAST a9=0)
I32 recvProtocol(U8 *const data, const U32 size)
Protocol specific implementation of recv. Called directly with error handling from recv.
SocketIpStatus
Status enumeration for socket return values.
Declares ISF basic types.
static SocketIpStatus addressToIp4(const char *address, void *ip4)
converts a given address in dot form x.x.x.x to an ip address. ONLY works for IPv4.
U16 m_port
IP address port used.
int NATIVE_INT_TYPE
native integer type declaration
void close(void)
closes the socket