Public Member Functions | Private Member Functions | Private Attributes | Friends | List of all members
OCL::TCP::Socket Class Reference

#include <socket.hpp>

Inheritance diagram for OCL::TCP::Socket:
Inheritance graph
[legend]

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
 

Detailed Description

Definition at line 36 of file socket.hpp.

Constructor & Destructor Documentation

OCL::TCP::Socket::Socket ( int  socketID)

Create an incoming server socket.

Parameters
portPort to listen on.

Definition at line 141 of file socket.cpp.

OCL::TCP::Socket::~Socket ( )

Definition at line 148 of file socket.cpp.

Member Function Documentation

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.

Friends And Related Function Documentation

friend class ::sockbuf
friend

Definition at line 37 of file socket.hpp.

Member Data Documentation

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.


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


ocl
Author(s): OCL Development Team
autogenerated on Mon Mar 23 2020 04:47:20