#include <TcpConnection.h>
Inheritance diagram for TcpConnection::
Public Methods | |
TcpConnection () | |
TcpConnection (SocketAddress) | |
TcpConnection (IpAddress ipAddr, unsigned short port) | |
TcpConnection (unsigned short port) | |
for passive connections. More... | |
virtual | ~TcpConnection () |
Closes the connection if it is open. More... | |
virtual SocketAddress * | getSocketAddress () |
virtual void | setSocketAddress (SocketAddress *) |
virtual int | getStream () |
virtual void | setStream (int stream) |
You can only set the stream if it isnt being used. More... | |
virtual int | connect () |
Connect to the IP address/port that is internally stored in this node. More... | |
virtual void | close () |
Close the stream to this node. More... | |
virtual int | listen () |
Used to accept incoming connections. More... | |
virtual ConnectionInterface * | accept () |
Accept handles incoming connect requests. More... | |
virtual bool | isConnected () |
Return true if we are connected to this Node, false otherwise. More... | |
virtual bool | isConnectedTo (IpAddress) |
Return true if this nodes IP address matches the parameter, and we are currently connected to it. More... | |
virtual int | read (unsigned char *buffer, int bufferSize, int amountToRead=0) |
Read data from the connection. More... | |
virtual int | write (unsigned char *buffer, int amountToWrite) |
Write the data to the stream. More... | |
virtual ConnectionInterface::ObjectType | getConnectionType () |
virtual void | toStream (std::ostream &out) |
Private Methods | |
void | setSocketOptions () |
Set our desired socket options for this application. More... | |
Static Private Methods | |
OS_SPEC_SOCKET_TYPE | createListeningSocket (SocketAddress socketAddress) |
Private Attributes | |
SocketAddress | m_socketAddress |
The IP and port. More... | |
OS_SPEC_SOCKET_TYPE | m_stream |
socket used to talk to a remote node; in the case of selfNode, all the listening sockets. More... | |
bool | m_isActive |
true if connection type is active, false if passive. More... |
Definition at line 25 of file TcpConnection.h.
|
Definition at line 9 of file TcpConnection.cpp. Referenced by accept().
|
|
Definition at line 15 of file TcpConnection.cpp. |
|
Definition at line 22 of file TcpConnection.cpp. |
|
for passive connections.
Definition at line 32 of file TcpConnection.cpp. |
|
Closes the connection if it is open.
Definition at line 42 of file TcpConnection.cpp. |
|
Accept handles incoming connect requests. After a connection is accepted, is it treated exactly like all other connections. Member function "listen" must be called before this function is called.
Reimplemented from ConnectionInterface. Definition at line 266 of file TcpConnection.cpp. Referenced by ProxyCommandProcessor::readCommand(), and HttpTestCommandProcessor::readCommand().
|
|
Close the stream to this node.
Reimplemented from ConnectionInterface. Definition at line 344 of file TcpConnection.cpp. Referenced by HttpTestCommandProcessor::changePort(), WebServer::handleConnection(), ProxyCommandProcessor::readCommand(), HttpTestCommandProcessor::readCommand(), and ~TcpConnection().
|
|
Connect to the IP address/port that is internally stored in this node.
Reimplemented from ConnectionInterface. Definition at line 79 of file TcpConnection.cpp. Referenced by WebServer::handleConnection().
|
|
Definition at line 229 of file TcpConnection.cpp. Referenced by listen().
|
|
Reimplemented from ConnectionInterface. Definition at line 48 of file TcpConnection.cpp. |
|
Reimplemented from ConnectionInterface. Definition at line 388 of file TcpConnection.cpp. Referenced by HttpTestCommandProcessor::HttpTestCommandProcessor(), HttpTestCommandProcessor::changePort(), ProxyCommandProcessor::toStream(), and HttpTestCommandProcessor::toStream().
|
|
Reimplemented from ConnectionInterface. Definition at line 403 of file TcpConnection.cpp. Referenced by read(), ProxyCommandProcessor::readCommand(), and HttpTestCommandProcessor::readCommand().
|
|
Return true if we are connected to this Node, false otherwise.
Reimplemented from ConnectionInterface. Definition at line 362 of file TcpConnection.cpp. Referenced by HttpTestCommandProcessor::HttpTestCommandProcessor(), close(), connect(), isConnectedTo(), read(), and setStream().
|
|
Return true if this nodes IP address matches the parameter, and we are currently connected to it.
Reimplemented from ConnectionInterface. Definition at line 377 of file TcpConnection.cpp. |
|
Used to accept incoming connections. This sets up the socket to listen, but this does not start accepting connections. (It returns immediately)
Reimplemented from ConnectionInterface. Definition at line 212 of file TcpConnection.cpp. Referenced by HttpTestCommandProcessor::HttpTestCommandProcessor(), ProxyCommandProcessor::ProxyCommandProcessor(), and HttpTestCommandProcessor::changePort().
|
|
Read data from the connection.
Reimplemented from ConnectionInterface. Definition at line 132 of file TcpConnection.cpp. Referenced by WebServer::handleConnection(), ProxyCommandProcessor::readCommand(), and HttpTestCommandProcessor::readCommand().
|
|
Reimplemented from ConnectionInterface. Definition at line 394 of file TcpConnection.cpp. Referenced by HttpTestCommandProcessor::changePort().
|
|
Set our desired socket options for this application. Assumptions: socket has been created sucessfully. Definition at line 58 of file TcpConnection.cpp. Referenced by accept(), and connect().
|
|
You can only set the stream if it isnt being used.
Reimplemented from ConnectionInterface. Definition at line 412 of file TcpConnection.cpp. Referenced by accept().
|
|
Reimplemented from BasicObject. Definition at line 420 of file TcpConnection.cpp. |
|
Write the data to the stream.
Reimplemented from ConnectionInterface. Definition at line 182 of file TcpConnection.cpp. Referenced by ProxyCommandProcessor::displayResponse(), HttpTestCommandProcessor::displayResponse(), and WebServer::handleConnection().
|
|
true if connection type is active, false if passive.
Definition at line 62 of file TcpConnection.h. |
|
The IP and port.
Definition at line 56 of file TcpConnection.h. |
|
socket used to talk to a remote node; in the case of selfNode, all the listening sockets.
Definition at line 59 of file TcpConnection.h. |