PAASS
Software suite to Acquire and Analyze Data from Pixie16
Server Class Reference

#include <poll2_socket.h>

Public Member Functions

 Server ()
 
 ~Server ()
 
int Get ()
 
bool Init (int port_, int sec_=10, int usec_=0)
 Initialize the serv object and open a specified port. Returns false if the socket fails to open or the socket fails to bind and returns true otherwise. More...
 
int RecvMessage (char *message_, size_t length_)
 
int SendMessage (char *message_, size_t length_)
 
bool Select (int &retval)
 
void Close ()
 Close the socket. More...
 

Private Attributes

int sock
 
int length
 
int n
 
socklen_t fromlen
 
struct sockaddr_in serv
 
struct sockaddr_in from
 
bool init
 
int to_sec
 
int to_usec
 
fd_set readfds
 
fd_set masterfds
 
struct timeval timeout
 

Detailed Description

Definition at line 23 of file poll2_socket.h.

Constructor & Destructor Documentation

§ Server()

Server::Server ( )
inline

Definition at line 36 of file poll2_socket.h.

§ ~Server()

Server::~Server ( )
inline

Definition at line 38 of file poll2_socket.h.

Here is the call graph for this function:

Member Function Documentation

§ Close()

void Server::Close ( )

Close the socket.

Definition at line 93 of file poll2_socket.cpp.

Here is the caller graph for this function:

§ Get()

int Server::Get ( )
inline

Definition at line 40 of file poll2_socket.h.

Here is the call graph for this function:

§ Init()

bool Server::Init ( int  port_,
int  sec_ = 10,
int  usec_ = 0 
)

Initialize the serv object and open a specified port. Returns false if the socket fails to open or the socket fails to bind and returns true otherwise.

Parameters
[in]port_The port number to use for the connection.
[in]sec_The number of seconds to wait for recieve timeout message.
[in]usec_The number of microseconds in addition to the above seconds to wait for recieve timeout message.
Returns
Returns false if the socket fails to open or bind.

Definition at line 40 of file poll2_socket.cpp.

Here is the caller graph for this function:

§ RecvMessage()

int Server::RecvMessage ( char *  message_,
size_t  length_ 
)

Receive a message from the socket. Returns the number of bytes received. Returns -1 if the receive fails or if the object was not initialized.

Definition at line 63 of file poll2_socket.cpp.

Here is the caller graph for this function:

§ Select()

bool Server::Select ( int &  retval)

Definition at line 79 of file poll2_socket.cpp.

Here is the caller graph for this function:

§ SendMessage()

int Server::SendMessage ( char *  message_,
size_t  length_ 
)

Send a message to the socket. Returns the number of bytes sent. Returns -1 if the send fails or if the object was not initialized.

Definition at line 73 of file poll2_socket.cpp.

Here is the caller graph for this function:

Field Documentation

§ from

struct sockaddr_in Server::from
private

Definition at line 28 of file poll2_socket.h.

§ fromlen

socklen_t Server::fromlen
private

Definition at line 26 of file poll2_socket.h.

§ init

bool Server::init
private

Definition at line 29 of file poll2_socket.h.

§ length

int Server::length
private

Definition at line 25 of file poll2_socket.h.

§ masterfds

fd_set Server::masterfds
private

Definition at line 32 of file poll2_socket.h.

§ n

int Server::n
private

Definition at line 25 of file poll2_socket.h.

§ readfds

fd_set Server::readfds
private

Definition at line 32 of file poll2_socket.h.

§ serv

struct sockaddr_in Server::serv
private

Definition at line 27 of file poll2_socket.h.

§ sock

int Server::sock
private

Definition at line 25 of file poll2_socket.h.

§ timeout

struct timeval Server::timeout
private

Definition at line 33 of file poll2_socket.h.

§ to_sec

int Server::to_sec
private

Definition at line 31 of file poll2_socket.h.

§ to_usec

int Server::to_usec
private

Definition at line 31 of file poll2_socket.h.


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