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
PlatformSizeType FwSizeType
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)
static void log(const char *format,...)
log a formated string with supplied arguments
Error occurred, retrying may succeed.
Receive worked, but there was no data.
Data send should be retried.
void readLoop() override
read from the socket, overridden to start and terminate the server socket
Status returned by the send call.
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
Operation worked as expected.
bool isStarted()
is started
void connected() override
called when the IPv4 system has been connected
void recv_out(FwIndexType portNum, Fw::Buffer &buffer, const Drv::ByteStreamStatus &status)
Invoke output port recv.
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
~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
U16 getListenPort()
get the port being listened on
PlatformIndexType FwIndexType
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
void dataReturnOut_out(FwIndexType portNum, Fw::Buffer &buffer, const Drv::ByteStreamStatus &status)
Invoke output port dataReturnOut.
bool running()
is the read loop running
static const Fw::TimeInterval SOCKET_RETRY_INTERVAL
void ready_out(FwIndexType portNum)
Invoke output port ready.