30 const U32 send_timeout_seconds,
31 const U32 send_timeout_microseconds,
36 FW_ASSERT(buffer_size <= std::numeric_limits<U32>::max(), static_cast<FwAssertArgType>(buffer_size));
37 m_allocation_size = buffer_size;
39 (void)m_socket.
configure(hostname, port, send_timeout_seconds, send_timeout_microseconds);
58 return allocate_out(0, static_cast<U32>(m_allocation_size));
72 this->
recv_out(0, buffer, recvStatus);
static Status delay(Fw::TimeInterval interval)
delay the current task
bool m_reopen
Force reopen on disconnect.
Auto-generated base for TcpServer component.
Interrupted status for retries.
SocketIpStatus startup(SocketDescriptor &socketDescriptor)
Opens the server socket and listens, does not block.
void sendBuffer(Fw::Buffer buffer, SocketIpStatus status) override
sends a buffer to be filled with data
SocketIpStatus send(const U8 *const data, const U32 size)
send data to the IP socket from the given buffer
IpSocket & getSocketHandler() override
returns a reference to the socket handler
bool isConnected_ready_OutputPort(FwIndexType portNum)
Status associated with the received data.
PlatformIntType NATIVE_INT_TYPE
Data send should be retried.
PlatformSizeType FwSizeType
void recv_out(FwIndexType portNum, Fw::Buffer &recvBuffer, const Drv::RecvStatus &recvStatus)
Invoke output port recv.
static void log(const char *format,...)
log a formated string with supplied arguments
Receive worked, but there was no data.
Receive worked as expected.
Receive error occurred retrying may succeed.
void readLoop() override
read from the socket, overridden to start and terminate the server socket
Socket operation successful.
SocketIpStatus configure(const char *hostname, const U16 port, const U32 send_timeout_seconds=SOCKET_SEND_TIMEOUT_SECONDS, const U32 send_timeout_microseconds=SOCKET_SEND_TIMEOUT_MICROSECONDS, FwSizeType buffer_size=1024)
Configures the TcpServer settings but does not open the connection.
U16 getListenPort()
get the port being listened on
bool isStarted()
is started
void connected() override
called when the IPv4 system has been connected
TcpServerComponentImpl(const char *const compName)
construct the TcpServer component.
Fw::Buffer allocate_out(FwIndexType portNum, U32 size)
Invoke output port allocate.
void terminate()
terminate the server socket
C++-compatible configuration header for fprime configuration.
~TcpServerComponentImpl()
Destroy the component.
virtual SocketIpStatus configure(const char *hostname, const U16 port, const U32 send_timeout_seconds, const U32 send_timeout_microseconds)
configure the ip socket with host and transmission timeouts
Status returned by the send call.
U16 getListenPort()
get the port being listened on
locks a mutex within the current scope
PlatformIntType serverFd
Used for server sockets to track the listening file descriptor.
virtual void readLoop()
receive off the TCP socket
SocketDescriptor m_descriptor
SocketIpStatus
Status enumeration for socket return values.
void terminate(const SocketDescriptor &socketDescriptor)
close the server socket created by the startup call
Socket has not been started.
Helper base-class for setting up Berkeley sockets.
No data available or read operation would block.
Fw::Buffer getBuffer() override
returns a buffer to fill with data
SocketIpStatus startup()
startup the server socket for communications
bool running()
is the read loop running
Send error occurred retrying may succeed.
void deallocate_out(FwIndexType portNum, Fw::Buffer &fwBuffer)
Invoke output port deallocate.
static const Fw::TimeInterval SOCKET_RETRY_INTERVAL
void ready_out(FwIndexType portNum)
Invoke output port ready.