ost::SimpleTCPStream(3)
π NAME π
ost::SimpleTCPStream β a Simple TCP Stream, bestie, made to be used with the Common C++ Library. Yes, this is the page for ost::SimpleTCPStream(3), and we're gonna get you fluent in it. π¦
β¨ SYNOPSIS β¨
#include <socket.h>
Inherits ost::Socket.
π«Ά Public Member Functions
SimpleTCPStream (TCPSocket &server, size_t size=512)β makes a TCP stream by accepting a connection from a bound TCP socket that's acting as a server.SimpleTCPStream (const IPV4Host &host, tpport_t port, size_t size=512)β makes a TCP stream by connecting to a TCP socket (on a remote machine).SimpleTCPStream (const SimpleTCPStream &source)β copy constructor, it spins up a whole new stream buffer.virtual ~SimpleTCPStream ()β flushes and empties every buffer, then removes the allocated buffers.bool isPending (Pending pend, timeout_t timeout=TIMEOUT_INF)β checks the status of pending stream data.void flush ()ssize_t read (char *bytes, size_t length, timeout_t timeout=0)β reads bytes into a buffer.ssize_t write (const char *bytes, size_t length, timeout_t timeout=0)β writes bytes to buffer.ssize_t peek (char *bytes, size_t length, timeout_t timeout=0)β peeks at the incoming data.
π Protected Member Functions
SimpleTCPStream ()β the constructor thatSimpleTCPStreamrequires, a more C++ style version of the class.void endStream (void)β terminates the buffer space and cleans up the socket connection.void Connect (const IPV4Host &host, tpport_t port, size_t size)β makes a TCP stream by connecting to a TCP socket (on a remote machine).
π Additional Inherited Members
(they're all just vibing in the base class, go look there π )
πΈ Detailed Description πΈ
Simple TCP Stream, to be used with Common C++ Library.
This source is derived from a proposal made by Ville Vainio (vvainio@tp.spt.fi). Give her her flowers. π
Author : Mark S. Millard (msm@wizzer.com)
Date : 2002-08-15 Copyright (C) 2002 Wizzer Works.
π Constructor & Destructor Documentation π
ost::SimpleTCPStream::SimpleTCPStream () [protected]
The constructor required for SimpleTCPStream, a more C++ style version of the SimpleTCPStream class.
ost::SimpleTCPStream::SimpleTCPStream (TCPSocket & server, size_t size = 512)
Makes a TCP stream by accepting a connection from a bound TCP socket acting as a server. This performs an 'accept' call. β¨
Parameters
- server β bound server tcp socket.
- size β of streaming input and output buffers.
ost::SimpleTCPStream::SimpleTCPStream (const IPV4Host & host, tpport_t port, size_t size = 512)
Makes a TCP stream by connecting to a TCP socket (on a remote machine). π°οΈ
Parameters
- host β address of remote TCP server.
- port β number to connect.
- size β of streaming input and output buffers.
ost::SimpleTCPStream::SimpleTCPStream (const SimpleTCPStream & source)
A copy constructor, it creates a new stream buffer. π«Ά
Parameters
- source β a reference to the
SimpleTCPStreamto copy.
virtual ost::SimpleTCPStream::~SimpleTCPStream () [virtual]
Flush and empty all buffers, and then remove the allocated buffers. Cleanup queen. π§Ή
π Member Function Documentation π
void ost::SimpleTCPStream::Connect (const IPV4Host & host, tpport_t port, size_t size) [protected]
Makes a TCP stream by connecting to a TCP socket (on a remote machine). π
Parameters
- host β address of remote TCP server.
- port β number to connect.
- size β of streaming input and output buffers.
void ost::SimpleTCPStream::endStream (void) [protected]
Used to terminate the buffer space and cleanup the socket connection. This function is called by the destructor. (ngl the original spells it "fucntion" and we love her for it π)
void ost::SimpleTCPStream::flush () [inline]
(no description, she's just here doing her little thing π )
bool ost::SimpleTCPStream::isPending (Pending pend, timeout_t timeout = TIMEOUT_INF) [virtual]
Gets the status of pending stream data. Use this to check if input or output is waiting, or if an error or disconnect has occurred on the stream. If a read buffer contains data then input is ready. If the write buffer contains data, it is first flushed and then checked. π
Parameters
- pend β flag indicating means to pend.
- timeout β the length of time to wait.
Reimplemented from ost::Socket.
ssize_t ost::SimpleTCPStream::peek (char * bytes, size_t length, timeout_t timeout = 0)
Peek at the incoming data. The data is copied into the buffer but is not removed from the input queue. Then it returns the number of bytes currently pending to receive. Like looking in the fridge without taking anything out, fr fr. π
Parameters
- bytes β a pointer to buffer that will contain the bytes read.
- length β the number of bytes to read (exactly).
- timeout β period to time out, in milliseconds.
Returns : The number of bytes pending on the input queue, 0 on EOF.
ssize_t ost::SimpleTCPStream::read (char * bytes, size_t length, timeout_t timeout = 0)
Read bytes into a buffer. <long-description>
Parameters
- bytes β a pointer to buffer that will contain the bytes read.
- length β the number of bytes to read (exactly).
- timeout β period to time out, in milliseconds.
Returns : The number of bytes actually read, 0 on EOF.
ssize_t ost::SimpleTCPStream::write (const char * bytes, size_t length, timeout_t timeout = 0)
Write bytes to buffer. <long-description>
Parameters
- bytes β a pointer to a buffer containing the bytes to write.
- length β the number of bytes to write (exactly).
- timeout β period to time out, in milliseconds.
Returns : The number of bytes actually written.
π Author π
Generated automatically by Doxygen for GNU CommonC++ from the source code.
okay bestie that's the whole page, every flag and param accounted for, no cap. π«Ά
Signing off: this was <b>GNU CommonC++</b>, dated <b>Sun Dec 27 2020</b>, on the <b>ost::SimpleTCPStream(3)</b> page β slay, 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