KServerSocket Class Reference
Monitors a port for incoming TCP/IP connections. More...
#include <ksock.h>

Public Slots | |
virtual void | slotAccept (int) |
Signals | |
void | accepted (KSocket *s) |
Public Member Functions | |
KServerSocket (unsigned short int _port, bool _bind=true) | |
KServerSocket (const char *_path, bool _bind=true) | |
virtual | ~KServerSocket () |
bool | bindAndListen () |
int | socket () const |
unsigned short int | port () |
unsigned long | ipv4_addr () |
Protected Member Functions | |
bool | init (unsigned short int) |
bool | init (const char *_path) |
Protected Attributes | |
int | sock |
Detailed Description
Monitors a port for incoming TCP/IP connections.
- Deprecated:
- This class is deprecated and will be removed in the future. Please use the classes in KNetwork for new programs. In special, this class is replaced by KNetwork::KStreamSocket and KNetwork::KServerSocket.
You can use a KServerSocket to listen on a port for incoming connections. When a connection arrived in the port, a KSocket is created and the signal accepted is raised. Make sure you always connect to this signal. If you don't the ServerSocket will create new KSocket's and no one will delete them!
If socket() is -1 or less the socket was not created properly.
Definition at line 250 of file ksock.h.
Constructor & Destructor Documentation
KServerSocket::KServerSocket | ( | unsigned short int | _port, | |
bool | _bind = true | |||
) |
KServerSocket::KServerSocket | ( | const char * | _path, | |
bool | _bind = true | |||
) |
KServerSocket::~KServerSocket | ( | ) | [virtual] |
Member Function Documentation
void KServerSocket::accepted | ( | KSocket * | s | ) | [signal] |
A connection has been accepted.
It is your task to delete the KSocket if it is no longer needed.
WARNING: this signal is always emitted, even if you don't connect anything to it. That would mean memory loss, because the KSockets created go to oblivion.
- Parameters:
-
s the socket that accepted
bool KServerSocket::bindAndListen | ( | ) |
unsigned long KServerSocket::ipv4_addr | ( | ) |
The address.
This is dumb. Don't use it Refer to KExtendedSocket::localAddress(int)
unsigned short int KServerSocket::port | ( | ) |
void KServerSocket::slotAccept | ( | int | ) | [virtual, slot] |
int KServerSocket::socket | ( | ) | const [inline] |
Member Data Documentation
int KServerSocket::sock [protected] |
The documentation for this class was generated from the following files: