#include <ksock.h>
Inherits TQObject.
Public Slots | |
void | slotWrite (int x) |
void | slotRead (int x) |
Signals | |
void | readEvent (TDESocket *s) |
void | writeEvent (TDESocket *s) |
void | closeEvent (TDESocket *s) |
Public Member Functions | |
TDESocket (int _sock) TDE_DEPRECATED | |
TDESocket (const char *_host, unsigned short int _port, int timeOut=30) TDE_DEPRECATED | |
TDESocket (const char *_path) TDE_DEPRECATED | |
virtual | ~TDESocket () |
int | socket () const |
void | enableRead (bool enable) |
void | enableWrite (bool enable) |
Protected Member Functions | |
bool | connect (const TQString &_host, unsigned short int _port, int timeout=0) |
bool | connect (const char *_path) |
Protected Attributes | |
int | sock |
Detailed Description
A TCP/IP client socket.
- Deprecated:
- You can connect this socket to any Internet address.
This class is deprecated and will be removed in the future. For new programs, please use KExtendedSocket class.
The socket gives you three signals: When ready for reading, ready for writing or if the connection is broken. Using socket() you get a file descriptor which you can use with the usual UNIX function like write() or read(). If you have already such a socket identifier you can construct a TDESocket on this identifier.
If socket() delivers a value of -1 or less, the connection was not successful.
Constructor & Destructor Documentation
◆ TDESocket() [1/3]
TDESocket::TDESocket | ( | int | _sock | ) |
◆ TDESocket() [2/3]
TDESocket::TDESocket | ( | const char * | _host, |
unsigned short int | _port, | ||
int | timeOut = 30 |
||
) |
◆ TDESocket() [3/3]
TDESocket::TDESocket | ( | const char * | _path | ) |
◆ ~TDESocket()
|
virtual |
Member Function Documentation
◆ closeEvent
|
signal |
Raised when the connection is broken.
- Parameters
-
s the TDESocket that triggered the event
◆ enableRead()
void TDESocket::enableRead | ( | bool | enable | ) |
Enables the socket for reading.
If you enable read mode, the socket will emit the signal readEvent() whenever there is something to read out of this socket.
- Parameters
-
enable true to enable reading signals
◆ enableWrite()
void TDESocket::enableWrite | ( | bool | enable | ) |
Enables the socket for writing.
If you enable write mode, the socket will emit the signal writeEvent() whenever the socket is ready for writing.
Warning: If you forget to call enableWrite(false) when you are not ready to send data, you will get lots of writeEvent() signals, in the order of thousands a second !
- Parameters
-
enable true to enable writing signals
◆ readEvent
|
signal |
Data has arrived for reading.
This signal will only be raised if enableRead( true
) was called first.
- Parameters
-
s the TDESocket that triggered the event
◆ slotRead
|
slot |
◆ slotWrite
|
slot |
◆ socket()
|
inline |
◆ writeEvent
|
signal |
Socket is ready for writing.
This signal will only be raised if enableWrite( true
) was called first.
Warning: If you forget to call enableWrite(false) when you are not ready to send data, you will get lots of writeEvent() signals, in the order of thousands a second !
- Parameters
-
s the TDESocket that triggered the event
The documentation for this class was generated from the following files: