Component index
Section index | Component tcpconnect |
Search |
Type | Function |
Summary | Manage a single TCP client session |
Description | It establish the connection, calls its init functag when successful and process the data received line by line. Supports both TCP and unix domain sockets. |
![]() ![]() | void end (TCPCONNECT &info) | |
![]() ![]() | void fail (TCPCONNECT_INFO &info) | |
![]() ![]() | void init (bool &end, TCPCONNECT_INFO &info) | |
![]() ![]() | void oneline (const char *line, bool &end, TCPCONNECT_INFO &info) | |
![]() ![]() | void time_out (bool &end, TCPCONNECT &info) |
Manage a TCP connection (or a unix domain socket). If host is "unix:", the port is the unix domain socket path. Return -1 if any error
You generally used this to send the first request and do various initialisation.
This assumes that the protocol is line oriented (ASCII).
No message was received for some time. The timeout is specified as an argument of the tcpconnect function.
Return the number of bytes sent or -1 if any error. This method may trigger the end() functag if the server has closed the connection.
Return the number of bytes sent or -1 if any error. This method may trigger the end() functag if the server has closed the connection.
Return the number of bytes sent or -1 if any error. This method may trigger the end() functag if the server has closed the connection.
At connect time, a timeout leads to the fail functag. Later, the time_out functag is called and the application decides if it wants to end the session.
At connect time, a timeout leads to the fail functag. Later, the time_out functag is called and the application decides if it wants to end the session.
Normally, the OS sends packets only when the transmit buffer is full, after some delay, or when the program waits for the other side. This is efficient network wise. Sometime you expect the data to leave immediatly (when you call send()). This helper lets you set the flag to on or off. It is off by default