#include <socket.hpp>
Public Member Functions | |
void | close () |
bool | dataAvailable () |
bool | isValid () const |
std::string | readLine () |
Socket (int socketID) | |
~Socket () | |
Private Member Functions | |
void | checkBufferOverflow () |
bool | lineAvailable () |
void | rawClose () |
Private Attributes | |
int | begin |
char | buffer [BUFLENGTH] |
int | end |
int | ptrpos |
int | socket |
Friends | |
class | ::sockbuf |
Definition at line 36 of file socket.hpp.
OCL::TCP::Socket::Socket | ( | int | socketID | ) |
Create an incoming server socket.
port | Port to listen on. |
Definition at line 141 of file socket.cpp.
Definition at line 148 of file socket.cpp.
void OCL::TCP::Socket::checkBufferOverflow | ( | ) | [private] |
Move all data in the buffer to the beginning of the buffer, if needed.
Definition at line 207 of file socket.cpp.
void OCL::TCP::Socket::close | ( | ) |
Close the connection. Send a nice message to the user.
Definition at line 278 of file socket.cpp.
bool OCL::TCP::Socket::dataAvailable | ( | ) |
Check wether there is new data available.
Definition at line 161 of file socket.cpp.
bool OCL::TCP::Socket::isValid | ( | ) | const |
Check wether the state of the socket is valid or not.
Definition at line 156 of file socket.cpp.
bool OCL::TCP::Socket::lineAvailable | ( | ) | [private] |
Return true when a line which is already stored in the buffer is available. Terminate the line with \0 and adjust ptrpos to this position.
Begin should be the beginning of the new line.
Definition at line 166 of file socket.cpp.
void OCL::TCP::Socket::rawClose | ( | ) | [private] |
Close socket without any message to the client.
Definition at line 268 of file socket.cpp.
std::string OCL::TCP::Socket::readLine | ( | ) |
Read a line from the socket.
Definition at line 222 of file socket.cpp.
friend class ::sockbuf [friend] |
Definition at line 37 of file socket.hpp.
int OCL::TCP::Socket::begin [private] |
Definition at line 71 of file socket.hpp.
char OCL::TCP::Socket::buffer[BUFLENGTH] [private] |
Definition at line 70 of file socket.hpp.
int OCL::TCP::Socket::end [private] |
Definition at line 73 of file socket.hpp.
int OCL::TCP::Socket::ptrpos [private] |
Definition at line 72 of file socket.hpp.
int OCL::TCP::Socket::socket [private] |
Socket ID
Definition at line 42 of file socket.hpp.