Faspstream Manager C/C++ API  3.6.1
A C and C++ language interface to basic streaming over the fasp protocol
FaspSocketChannel Class Reference

#include <FaspSocketChannel.h>

Inheritance diagram for FaspSocketChannel:
FaspConnectionChannel

Public Member Functions

 FaspSocketChannel (fasp_stream_socket_wrapper_t *w)
 
int write (const char *buff, size_t len)
 
int read (char *buff, size_t len)
 
void close ()
 

Constructor & Destructor Documentation

FaspSocketChannel::FaspSocketChannel ( fasp_stream_socket_wrapper_t w)
inline

Member Function Documentation

void FaspSocketChannel::close ( )
inlinevirtual

Internal code calls this when it is finished sharing the TCP connection. You do not need to close the TCP connection you are sharing, but this gives you an opportunity to do so if you wish.

Implements FaspConnectionChannel.

int FaspSocketChannel::read ( char *  buff,
size_t  bytes 
)
inlinevirtual

Should return number of bytes read from TCP socket.

IMPORTANT: Your implementation should be non-blocking / timeout. For example, you can configure the TCP socket to timeout after trying to read for so many milliseconds. If you don't set a timeout or make this non-blocking, internal code will hang trying to read.

Return zero for end of file, negative for error.

Throw a FaspChannelTimeoutException if a timeout occurred / there is nothing to read.

Throw a FaspChannelClosedException if the TCP socket (unexpectedly) closed.

Implements FaspConnectionChannel.

int FaspSocketChannel::write ( const char *  data,
size_t  bytes 
)
inlinevirtual

Should return number of bytes written.

write does not need to be non-blocking / have a timeout. It can, however, and internal code will continue to retry writing.

Return negative on error.

Throw FaspChannelClosedException if the TCP socket (unexpectedly) closed.

Implements FaspConnectionChannel.


The documentation for this class was generated from the following file: