#include <Connection.h>
Collaboration diagram for Connection:
Public Methods | |
Connection () | |
Connection (const char *hostname, int port, int iSize) | |
~Connection () | |
bool | connect (const char *host, int port) |
void | disconnect (void) |
bool | isConnected (void) const |
int | message_loop (FILE *in, FILE *out) |
int | receiveMessage (char *msg, int maxsize) |
bool | sendMessage (const char *msg) |
void | show (ostream os) |
Private Attributes | |
Socket | m_sock |
int | m_iMaxMsgSize |
Definition at line 64 of file Connection.h.
|
Default constructor. Only sets the maximum message size. Definition at line 63 of file Connection.C. References m_iMaxMsgSize. |
|
Constructor makes a connection with the server using the connect method.
Definition at line 72 of file Connection.C. References connect(), Logger::log(), and m_iMaxMsgSize. |
|
Deconstructor closes the connection with the server Definition at line 84 of file Connection.C. References disconnect(). |
|
This method sets up a connection with the server.
Definition at line 93 of file Connection.C. References m_sock, _socket::serv_addr, and _socket::socketfd. Referenced by Connection(). |
|
This method closes the current socket connection. Definition at line 151 of file Connection.C. References isConnected(), m_sock, and _socket::socketfd. Referenced by main(), and ~Connection(). |
|
This method determines whether the socket connection is connected.
Definition at line 162 of file Connection.C. References m_sock, and _socket::socketfd. Referenced by disconnect(), and show(). |
|
This method always loops and waits for input. When input is received from fpin then this input is send to the server using the current connection. When message is received from the server, this message is sent to fpout.
Definition at line 227 of file Connection.C. References m_iMaxMsgSize, m_sock, receiveMessage(), sendMessage(), and _socket::socketfd. |
|
This method reads a message from the connection. When there is no message available, it blocks till it receives a message.
Definition at line 172 of file Connection.C. References m_sock, _socket::serv_addr, and _socket::socketfd. Referenced by SenseHandler::handleMessagesFromServer(), and message_loop(). |
|
This method sends a message to the server using the current connection.
Definition at line 210 of file Connection.C. References m_sock, _socket::serv_addr, and _socket::socketfd. Referenced by message_loop(), ActHandler::sendCommands(), ActHandler::sendMessage(), and ActHandler::sendMessageDirect(). |
|
This method prints whether the connection is up or not.
Definition at line 276 of file Connection.C. References isConnected(). |
|
maximum message size for send and receive Definition at line 67 of file Connection.h. Referenced by Connection(), and message_loop(). |
|
communication protocol with the server. Definition at line 66 of file Connection.h. Referenced by connect(), disconnect(), isConnected(), message_loop(), receiveMessage(), and sendMessage(). |