This class represents a TCP connection between a client and a server.
A Connection is used by multiple proxies simultaneously. It is also used to send event messages from a server to a client.
Messages sent between the client and the server are split up into frames, with each frame being transmitted on a specific channel.
Each connection is handled by a thread. Incoming requests or event messages will typically be handled by a separate thread obtained from a ThreadPool, but this is outside the scope of the Connection object.
Member Functions: abort, addCapability, allocChannel, close, getIdleTimeout, hasCapability, id, localAddress, mode, peerHasCapability, popFrameHandler, processFrame, pushFrameHandler, receiveBYE, receiveFrame, receiveHELO, receiveNBytes, releaseChannel, remoteAddress, returnFrame, run, runImpl, secure, sendBYE, sendFrame, sendHELO, sendProtocolFrame, setIdleTimeout, socket, state, waitReady
A connection created by a client.
A connection created by a server.
The connection has been established, but no handshake (HELO) frames have been exchanged.
The first handshake frame has been sent, and the connection is waiting for the peer's handshake frame.
The connection is ready.
The connection is being actively closed and a BYE frame has been sent to the peer. Waiting for the confirming BYE frame from the peer.
A BYE frame has been received and a confirming BYE frame will be sent.
The connection has been forcefully closed, without a closing handshake, due to a protocol violation.
The connection has been orderly closed.
Creates the Connection for the given socket and endpoint mode.
Destroys the Connection.
Aborts the connection.
Adds the given capability to the connection.
This must be done before the connection handshake takes place.
Allocates a channel number.
Orderly closes the connection.
Poco::Timespan getIdleTimeout() const;
Returns the idle connection timeout.
Returns true if the connection has the given capability.
Poco::UInt32 id() const;
Returns the ID of the connection. This is unique within the server or client process among all connections.
Poco::Net::SocketAddress localAddress() const;
Returns the socket's local address.
ConnectionMode mode() const;
Returns the connection mode.
Returns true if the peer has the given capability.
Peer capabilities will be available after the connection handshake.
Removes the FrameHandler from the internal stack.
Pushes the FrameHandler to the internal stack.
Releases the given channel number.
Poco::Net::SocketAddress remoteAddress() const;
Returns the remote peer's socket address.
Returns the frame to the pool.
bool secure() const;
Returns true if and only if the connection uses a secure socket.
Send a single frame. The connection must be in STATE_ESTABLISHED.
Sets the timeout after an idle connection is closed.
Poco::Net::StreamSocket socket() const;
Returns the underlying socket.
ConnectionState state() const;
Returns the connection state.
Poco::Timespan timeout = 2 * TIMEOUT_HELO
Waits until the connection is established, or the given timeout expires.
Process a single frame.
Waits for and receives the final BYE frame.
Receives the next frame from the connection, or returns null if no frame has been received within a certain time.
Waits for and receives the initial HELO frame.
char * buffer,
Receive exactly the given number of bytes.
Handle incoming frames.
See also: Poco::Runnable::run()
Handle incoming frames.
Sends the final BYE frame.
Sends the initial HELO frame.
Send a single protocol frame.
Fired after the connection has been aborted.
Fired after the connection has been closed.
Fired when the connection is about to be closed.
Fired after the handshake is complete and the connection has been established.