class protocol_stream ifndef WIN32: public iostream endif

subclass if iostream, hide from user the communication details

Inheritance:


Public Methods

protocol_stream( SOCKET sock, int gen_timeout )
at the beginning set the everything_read to false, because we have prompt
protocol_stream& operator >>( std::string &s )
s will remains empty only if it is nothing to read
protocol_stream& operator >>( int &value )
assume that there are nothing on that string except this integer, this is simplification of protocol, be warned
protocol_stream& operator >>( std::vector< std::string > &lines )
download everything between -> and <-
protocol_stream& operator <<( const std::string &s )
void wait_input()
we know that input is available
bool test_for_input( int millisec )
bool test_for_any_pending_input( int millisec )
test not only socket, but the buffer as well
bool is_command( const std::string &s )
test if s is equal to the word 'command'
ifdef WIN32 bool buffer_is_empty()
bool eof()
int peek()
returns -1 if no input, or the next char
int get( char &location )
char* getline( char *buf, unsigned size )
void skip_to_prompt()
before reading, check for everything_read flag
void skip_to_prompt( std::vector< std::string > &messages )
void append_messages( std::vector< std::string > &msgs )

Private Fields

SOCKET sock
char input_buffer[1024]
buffer input data here
unsigned input_buffer_offset
unsigned input_buffer_end
bool before_mark
bool everything_read
std::vector < std::string > messages
const static char prompt[]
const static char command[]
const int genericTimeout

Documentation

subclass if iostream, hide from user the communication details. After discovering many-many bugs in NT and VC 5.0 this is replaced by my own stream, not subclassing from iostream
SOCKET sock

char input_buffer[1024]
buffer input data here

unsigned input_buffer_offset

unsigned input_buffer_end

bool before_mark

bool everything_read

std::vector < std::string > messages

const static char prompt[]

const static char command[]

const int genericTimeout

protocol_stream( SOCKET sock, int gen_timeout )
at the beginning set the everything_read to false, because we have prompt

protocol_stream& operator >>( std::string &s )
s will remains empty only if it is nothing to read

protocol_stream& operator >>( int &value )
assume that there are nothing on that string except this integer, this is simplification of protocol, be warned

protocol_stream& operator >>( std::vector< std::string > &lines )
download everything between -> and <-

protocol_stream& operator <<( const std::string &s )

void wait_input()
we know that input is available

bool test_for_input( int millisec )

bool test_for_any_pending_input( int millisec )
test not only socket, but the buffer as well

bool is_command( const std::string &s )
test if s is equal to the word 'command'

ifdef WIN32 bool buffer_is_empty()

bool eof()

int peek()
returns -1 if no input, or the next char

int get( char &location )

char* getline( char *buf, unsigned size )

void skip_to_prompt()
before reading, check for everything_read flag. If nothing to wait from input, return. After sending the command that should return something, user must call wait_input, which indicates that sequence of -> and <- should appear in input before '>>>'

void skip_to_prompt( std::vector< std::string > &messages )

void append_messages( std::vector< std::string > &msgs )


This class has no child classes.

alphabetic index html hierarchy of classes or java



This page was generated with the help of DOC++.