SocketTCP Class Reference
[Internet protocol sockets]

generic TCP-IP communication class, parent of all other TCP-IP communication classes More...

#include <socketTCP.h>

Inheritance diagram for SocketTCP:

ClientTCP ServerTCP

List of all members.

Public Member Functions

int getInt (int &n)
int getDouble (Decimal &d)
int sendInt (int n)
int sendDouble (Decimal d)
int sendMessage (char *buf, int size)
int getMessage (char *buf, int size)
int waitMessage (char *msg)
 SocketTCP ()
 default constructor
void setBufSize (int a)
void ack ()
 send ACK
void ok ()
 send ok
void waitAck ()
 wait for ACK
void waitOk ()
 wait for ok
int checkMessagePresence (void)
 check if incoming messages are present
void closeConnection ()

Public Attributes

int m_port
 port on which the messages are send
int m_ds_sock_client
struct sockaddr_in my_addr
 my address
char m_buffer [TCP_MSG_SIZE+1]
 buffer for small size messages (fixed size is TCP_MSG_SIZE+1)
char * buffer
 buffer of variable size for big size messages
int bufsize
 size of buffer


Detailed Description

generic TCP-IP communication class, parent of all other TCP-IP communication classes

Author:
Paolo Stegagno

Constructor & Destructor Documentation

SocketTCP::SocketTCP (  ) 

default constructor


Member Function Documentation

int SocketTCP::getInt ( int &  n  ) 

int SocketTCP::getDouble ( Decimal d  ) 

int SocketTCP::sendInt ( int  n  ) 

int SocketTCP::sendDouble ( Decimal  d  ) 

int SocketTCP::sendMessage ( char *  buf,
int  size 
)

send a message

Parameters:
buf pointer to the message
size size of the message

int SocketTCP::getMessage ( char *  buf,
int  size 
)

get a message

Parameters:
buf pointer to the message
size size of the message

int SocketTCP::waitMessage ( char *  msg  ) 

wait untill a selected message is received

Parameters:
msg message to be received

void SocketTCP::setBufSize ( int  a  )  [inline]

set buffer size

Parameters:
a size to which set the buffer size

void SocketTCP::ack (  )  [inline]

send ACK

void SocketTCP::ok (  )  [inline]

send ok

void SocketTCP::waitAck (  )  [inline]

wait for ACK

void SocketTCP::waitOk (  )  [inline]

wait for ok

int SocketTCP::checkMessagePresence ( void   ) 

check if incoming messages are present

void SocketTCP::closeConnection (  ) 


Member Data Documentation

port on which the messages are send

Reimplemented in ServerTCP, and ClientTCP.

struct sockaddr_in SocketTCP::my_addr [read]

my address

char SocketTCP::m_buffer[TCP_MSG_SIZE+1]

buffer for small size messages (fixed size is TCP_MSG_SIZE+1)

buffer of variable size for big size messages

size of buffer


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

Generated on Mon Feb 20 07:01:10 2017 for MIP by  doxygen 1.5.6