Signals | |
void | connectionStateSignal (unsigned char status, char *hostname, int port) |
Raised when the status of the socket connection has changed. | |
Public Member Functions | |
GDataExchange (GDataReader *reader) | |
Creates a new data exchange object. | |
~GDataExchange (void) | |
Destroys the data exchange object. | |
bool | setupServerSocket (void) |
Finds a free port in the range GDE_PORTRANGE_LO and GDE_PORTRANGE_HI and creates a server socket listening on this port. | |
void | asyncSend (unsigned char *data, unsigned int size) |
Asynchronously sends out data. | |
unsigned int | syncSend (unsigned char *data, unsigned int size) |
Synchronously sends out data. | |
unsigned int | syncRead (unsigned char *buffer, unsigned int size) |
Synchronously reads data. | |
Private Slots | |
void | acceptedSlot (KSocket *sock) |
Called when the server socket accepted a connection. | |
void | readSlot (KSocket *sock) |
Called when data is available for reading. | |
void | writeSlot (KSocket *sock) |
Called when the socket is ready for writing. | |
void | closeSlot (KSocket *sock) |
Called when the socket connection was closed. | |
Private Member Functions | |
void | closeServerSocket (void) |
Closes the server socket. | |
Private Attributes | |
Q_OBJECT KServerSocket * | serverSocket |
The server socket, which controls all connections to clients. | |
KSocket * | socket |
The socket that is used in the current connection. | |
GBuffer * | outData |
The outbound data buffer. | |
GBuffer * | inData |
The inbound data buffer. | |
GDataReader * | dataReader |
Pointer to a class that handles incoming data. | |
char | hostname [GDE_HOSTNAME_MAXLEN] |
The name of the host Grisu is running on. | |
int | port |
The number of the port that is used in the current connection (-1 if no connection has been established so far). |
GDataExchange provides both asynchronous and synchronous I/O on the socket connection.
In asnychronous mode, when incoming data becomes available, this data is read without any interaction from outside this class. After reading has completed, a signal is raised which contains the data as an argument.
Outbound data is buffered within GDataExchange and then sent out asynchronously.
|
Creates a new data exchange object. Sets up the server socket.
|
|
Destroys the data exchange object.
|
|
Called when the server socket accepted a connection.
|
|
Asynchronously sends out data.
|
|
Closes the server socket.
|
|
Called when the socket connection was closed.
|
|
Raised when the status of the socket connection has changed.
|
|
Called when data is available for reading.
After all available data was read, it is passed on to
|
|
Finds a free port in the range
Raises a
|
|
Synchronously reads data. If no data is available, this method immediately returns (non-blocking I/O).
|
|
Synchronously sends out data.
Does not return before the data has been sent. This method performs the same functionality as
|
|
Called when the socket is ready for writing.
Writes all data on
|
|
Pointer to a class that handles incoming data.
|
|
The name of the host Grisu is running on.
|
|
The inbound data buffer.
|
|
The outbound data buffer.
|
|
The number of the port that is used in the current connection (
|
|
The server socket, which controls all connections to clients.
|
|
The socket that is used in the current connection.
|