SoDaRadio-5.0.3-master:8901fb5
|
This is an IP socket that returns newline-delimited strings arriving on the socket. More...
#include <LineSocket.hxx>
Public Member Functions | |
LineServerSocket (int portnum, TransportType transport=TCP) | |
constructor More... | |
int | getLine (char *buf, unsigned int maxsize) |
capture a newline-terminated buffer from the socket This is a non-blocking method. More... | |
Public Member Functions inherited from SoDa::IP::ServerSocket | |
ServerSocket (int portnum, TransportType transport=TCP) | |
~ServerSocket () | |
bool | isReady () |
int | get (void *ptr, unsigned int size) |
int | put (const void *ptr, unsigned int size) |
Public Member Functions inherited from SoDa::IP::NetSocket | |
NetSocket () | |
int | put (const void *ptr, unsigned int size) |
int | get (void *ptr, unsigned int size) |
int | putRaw (const void *ptr, unsigned int size) |
int | getRaw (const void *ptr, unsigned int size, unsigned int usec_timeout=0) |
get a raw string of <size> bytes... More... | |
void | setNonBlocking () |
void | setBlocking () |
Static Public Attributes | |
static const unsigned int | temp_buf_size = 128 |
This is the size of the running buffer that we read into from the socket. More... | |
Protected Attributes | |
std::queue< char > | inbuf |
Do this the simple way – accumulate characters in a queue then return each "\n" terminated substring as we find it. More... | |
int | ready_line_count |
keep a count of the number of "\n" delimited strings we've seen that haven't yet been returned from getLine() More... | |
char | temp_buf [temp_buf_size] |
This is the running buffer that we read into from the socket. More... | |
Protected Attributes inherited from SoDa::IP::ServerSocket | |
bool | ready |
Additional Inherited Members | |
Public Attributes inherited from SoDa::IP::NetSocket | |
int | server_socket |
int | conn_socket |
int | portnum |
struct sockaddr_in server_address | client_address |
bool | non_blocking_mode |
struct timeval | timeout |
This is an IP socket that returns newline-delimited strings arriving on the socket.
LineServerSocket builds on the IP::ServerSocket class.
Definition at line 48 of file LineSocket.hxx.
|
inline |
constructor
Definition at line 56 of file LineSocket.hxx.
References ready_line_count, and SoDa::IP::NetSocket::setNonBlocking().
|
inline |
capture a newline-terminated buffer from the socket This is a non-blocking method.
buf | pointer to a buffer to receive the string – newline is removed. |
maxsize | maximum allowed length of string. |
Definition at line 84 of file LineSocket.hxx.
References SoDa::IP::NetSocket::conn_socket, inbuf, SoDa::IP::ServerSocket::isReady(), SoDa::IP::ServerSocket::ready, ready_line_count, and temp_buf.
Referenced by main().
|
protected |
Do this the simple way – accumulate characters in a queue then return each "\n" terminated substring as we find it.
Definition at line 148 of file LineSocket.hxx.
Referenced by getLine().
|
protected |
keep a count of the number of "\n" delimited strings we've seen that haven't yet been returned from getLine()
Definition at line 154 of file LineSocket.hxx.
Referenced by getLine(), and LineServerSocket().
|
protected |
This is the running buffer that we read into from the socket.
This is NOT the maximum length of an unterminated string, as characters are read from the temp_buf and then pushed onto a queue.
Definition at line 162 of file LineSocket.hxx.
Referenced by getLine().
|
static |
This is the size of the running buffer that we read into from the socket.
This is NOT the maximum length of an unterminated string, as characters are read from the temp_buf and then pushed onto a queue.
Definition at line 71 of file LineSocket.hxx.