#include <nnclientsocket.h>
Inheritance diagram for NewNet::ClientSocket:

Public Member Functions | |
| ClientSocket () | |
| Create an empty client socket. | |
| virtual void | disconnect () |
| Disconnect the client socket. | |
| virtual void | process () |
| Process network events. | |
| void | send (const unsigned char *data, size_t n) |
| Append data to the send buffer. | |
| Buffer & | sendBuffer () |
| Return a reference to the send buffer. | |
| Buffer & | receiveBuffer () |
| Return a reference to the receive buffer. | |
Public Attributes | |
| Event< ClientSocket * > | cannotConnectEvent |
| Invoked when the socket can't connect. | |
| Event< ClientSocket * > | connectedEvent |
| Invoked when the socket is connected. | |
| Event< ClientSocket * > | disconnectedEvent |
| Invoked when the socket is disconnected. | |
| Event< ClientSocket * > | dataReceivedEvent |
| Invoked when there's new data waiting in the receive buffer. | |
| Event< ClientSocket * > | dataSentEvent |
| Invoked when data has been sent through the network socket. | |
Definition at line 34 of file nnclientsocket.h.
| NewNet::ClientSocket::ClientSocket | ( | ) | [inline] |
This will create an empty client socket. The client socket starts in an uninitialized state without a descriptor.
Definition at line 40 of file nnclientsocket.h.
| void NewNet::ClientSocket::disconnect | ( | ) | [virtual] |
This immediately disconnects the client socket and invokes the disconnected event.
Definition at line 26 of file nnclientsocket.cpp.
References NewNet::Socket::descriptor(), disconnectedEvent, NewNet::Socket::setSocketState(), NewNet::Socket::SocketConnected, NewNet::Socket::SocketDisconnected, and NewNet::Socket::socketState().
| void NewNet::ClientSocket::process | ( | ) | [virtual] |
This method is called by the reactor, it will process the events specified in readyState(): read from the socket, detect disconnections and send data through the socket.
Reimplemented from NewNet::Socket.
Definition at line 40 of file nnclientsocket.cpp.
References NewNet::Buffer::append(), cannotConnectEvent, connectedEvent, NewNet::Buffer::count(), NewNet::Buffer::data(), dataReceivedEvent, dataSentEvent, NewNet::Socket::dataWaiting(), NewNet::Socket::descriptor(), disconnectedEvent, NewNet::Socket::downRateLimiter(), NewNet::Socket::ErrorCannotConnect, NewNet::Socket::ErrorUnknown, NewNet::Socket::readyState(), NewNet::Buffer::seek(), send(), NewNet::Socket::setDataWaiting(), NewNet::Socket::setReadyState(), NewNet::Socket::setSocketError(), NewNet::Socket::setSocketState(), NewNet::Socket::SocketConnected, NewNet::Socket::SocketConnecting, NewNet::Socket::SocketDisconnected, NewNet::Socket::socketState(), NewNet::Socket::StateException, NewNet::Socket::StateReceive, NewNet::Socket::StateSend, NewNet::RateLimiter::transferred(), and NewNet::Socket::upRateLimiter().
| void NewNet::ClientSocket::send | ( | const unsigned char * | data, | |
| size_t | n | |||
| ) | [inline] |
This is a convenience function that will append data to the send buffer and will mark the flag that specifies that the socket wants to send data.
Definition at line 59 of file nnclientsocket.h.
References NewNet::Buffer::append(), NewNet::Buffer::count(), and NewNet::Socket::setDataWaiting().
Referenced by process().
| Buffer& NewNet::ClientSocket::sendBuffer | ( | ) | [inline] |
Returns a reference to the send buffer. Note: if you manipulate the send buffer, be sure to call setDataWaiting(bool) to make sure the data waiting flag is set correctly.
Definition at line 69 of file nnclientsocket.h.
| Buffer& NewNet::ClientSocket::receiveBuffer | ( | ) | [inline] |
Returns a reference to the receive buffer.
Definition at line 76 of file nnclientsocket.h.
This event will be invoked when the socket detects it cannot connect to the remote host.
Definition at line 84 of file nnclientsocket.h.
Referenced by NewNet::UnixClientSocket::connect(), NewNet::TcpClientSocket::connect(), and process().
This event will be invoked when the socket detects it has successfully connected to the remote host.
Definition at line 88 of file nnclientsocket.h.
Referenced by NewNet::UnixClientSocket::connect(), NewNet::TcpClientSocket::connect(), and process().
This event will be invoked when the socket has been disconnected from the remote host.
Definition at line 92 of file nnclientsocket.h.
Referenced by disconnect(), and process().
This event will be invoked when the socket received information from the remote host. The information will be appended to the receive buffer.
Definition at line 97 of file nnclientsocket.h.
Referenced by process().
This event will be invoked when data has been send to the remote host.
Definition at line 101 of file nnclientsocket.h.
Referenced by process().
1.5.1