ost::TCPSession(3)
π ost::TCPSession(3) β Library Functions Manual π
okay bestie, pull up a chair, we're talking about ost::TCPSession from the GNU CommonC++ library, and honestly? she's that girl. she's a TCP session, and her whole thing is being a client connection that you can run on its own separate thread. main character energy, fr fr. π
β¨ NAME β¨
ost::TCPSession β the TCP session is used to primarily to represent a client connection that can be managed on a separate thread. π¦
πΈ SYNOPSIS πΈ
#include <socket.h>
Inherits ost::Thread, and ost::TCPStream. yes bestie, she's got two parents and both of them are iconic. π
π Public Member Functions π
TCPSession (const IPV4Host &host, tpport_t port, size_t size=536, int pri=0, size_t stack=0)β Create a TCP socket that will be connected to a remote TCP server and that will execute under it's own thread.TCPSession (const IPV6Host &host, tpport_t port, size_t size=536, int pri=0, size_t stack=0)β same vibe, but the IPv6 edition. πTCPSession (TCPSocket &server, int pri=0, size_t stack=0)β Create a TCP socket from a bound TCP server by accepting a pending connection from that server and execute a thread for the accepted connection.TCPSession (TCPV6Socket &server, int pri=0, size_t stack=0)β the v6 twin of the above. β¨virtual ~TCPSession ()β Make sure destruction happens through a virtual... (the original page literally trails off there, so we're keeping it exactly that mysterious. no cap.)
π§ Protected Member Functions π§
int waitConnection (timeout_t timeout=TIMEOUT_INF)β Normally called during the thread Initial() method by default, this will wait for the socket connection to complete when connecting to a remote socket.void initial (void)β The initial method is used to esablish a connection when delayed completion is used.
π Additional Inherited Members π
(they're inherited, they're extra, they're serving.)
π Detailed Description π
The TCP session is used to primarily to represent a client connection that can be managed on a separate thread.
The TCP session also supports a non-blocking connection scheme which prevents blocking during the constructor and moving the process of completing a connection into the thread that executes for the session. it's giving "don't wait around for anyone, bestie." π
Author
David Sugar dyfet@ostel.com
Threaded streamable socket with non-blocking constructor.
Examples
tcpthread.cpp.
π Constructor & Destructor Documentation π
ost::TCPSession::TCPSession (const IPV4Host & host, tpport_t port, size_t size = 536, int pri = 0, size_t stack = 0)
Create a TCP socket that will be connected to a remote TCP server and that will execute under it's own thread.
Parameters
- host β internet address of remote TCP server.
- port β number of remote server.
- size β of streaming buffer.
- pri β execution priority relative to parent.
- stack β allocation needed on some platforms.
ost::TCPSession::TCPSession (const IPV6Host & host, tpport_t port, size_t size = 536, int pri = 0, size_t stack = 0)
(v6 version, same energy. π)
ost::TCPSession::TCPSession (TCPSocket & server, int pri = 0, size_t stack = 0)
Create a TCP socket from a bound TCP server by accepting a pending connection from that server and execute a thread for the accepted connection. she's literally accepting what the server is serving. π«Ά
Parameters
- server β tcp socket to accept a connection from.
- pri β execution priority relative to parent.
- stack β allocation needed on some platforms.
ost::TCPSession::TCPSession (TCPV6Socket & server, int pri = 0, size_t stack = 0)
(the v6 twin again, still iconic. β)
virtual ost::TCPSession::~TCPSession () [virtual]
Make sure destruction happens through a virtual... and that's where the sentence ends, bestie, we don't make the rules, we just relay them verbatim. π
π Member Function Documentation π
void ost::TCPSession::initial (void) [protected], [virtual]
The initial method is used to esablish a connection when delayed completion is used. This assures the constructor terminates without having to wait for a connection request to complete. lowkey the politest thing a constructor can do β it just leaves instead of standing there waiting. π
Reimplemented from ost::Thread.
int ost::TCPSession::waitConnection (timeout_t timeout = TIMEOUT_INF) [protected]
Normally called during the thread Initial() method by default, this will wait for the socket connection to complete when connecting to a remote socket. One might wish to use setCompletion() to change the socket back to blocking I/O calls after the connection completes. To implement the session one must create a derived class which implements run(). yes bestie, you gotta do the subclass thing. iykyk. π₯
Returns
0 if successful, -1 if timed out.
Parameters
- timeout β to wait for completion in milliseconds.
π Author π
Generated automatically by Doxygen for GNU CommonC++ from the source code.
and that's the whole page, bestie!! generated automatically by Doxygen for GNU CommonC++ from the source code, and stamped GNU CommonC++ β Sun Dec 27 2020 β ost::TCPSession(3) down at the bottom. periodt. πβ¨ππ¦πΈπ π«Άππ₯ππβππππ§π
π¦ where this page comes from
- ubuntu jammy: libcommoncpp2-doc 1.8.1-10
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms