#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 75 of file Connection.h.
|
Default constructor. Only sets the maximum message size. Definition at line 72 of file Connection.cpp. References m_iMaxMsgSize. |
|
Constructor makes a connection with the server using the connect method.
Definition at line 81 of file Connection.cpp. References connect(), Logger::log(), and m_iMaxMsgSize. |
|
Deconstructor closes the connection with the server Definition at line 93 of file Connection.cpp. References disconnect(). |
|
This method sets up a connection with the server.
Definition at line 102 of file Connection.cpp. References m_sock, _socket::serv_addr, and _socket::socketfd. Referenced by Connection(). |
|
This method closes the current socket connection. Definition at line 184 of file Connection.cpp. References isConnected(), m_sock, and _socket::socketfd. Referenced by main(), and ~Connection(). |
|
This method determines whether the socket connection is connected.
Definition at line 199 of file Connection.cpp. 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 271 of file Connection.cpp. 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 209 of file Connection.cpp. 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 253 of file Connection.cpp. 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 321 of file Connection.cpp. References isConnected(). |
|
max message size for send and receive Definition at line 78 of file Connection.h. Referenced by Connection(), and message_loop(). |
|
communication protocol with the server. Definition at line 77 of file Connection.h. Referenced by connect(), disconnect(), isConnected(), message_loop(), receiveMessage(), and sendMessage(). |