ost::TCPSession(3)

πŸ“¦ version 1.8.1, in ubuntu jammy

πŸ’– 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