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


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.
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.
- Author:
- Torben Weis <weis@stud.uni-frankfurt.de>
Definition at line 250 of file ksock.h.
Constructor & Destructor Documentation
|
Constructor.
Definition at line 292 of file ksock.cpp. References init(). |
|
Creates a UNIX domain server socket.
Definition at line 283 of file ksock.cpp. References init(). |
|
Destructor. Closes the socket if it was not already closed. |
Member Function Documentation
|
Binds the socket and start listening. This should only be called once when the constructor was called with _bind false. On error the socket will be closed.
Definition at line 329 of file ksock.cpp. References QObject::connect(), kdWarning(), slotAccept(), and sock. Referenced by init(). |
|
Returns the file descriptor associated with the socket.
|
|
Returns the port number which is being monitored.
Definition at line 353 of file ksock.cpp. References KSocketAddress::address(), kde_sockaddr_in6::sin6_port, and sock. |
|
The address. This is dumb. Don't use it Refer to KExtendedSocket::localAddress(int) Definition at line 377 of file ksock.cpp. References KSocketAddress::address(), KInetSocketAddress::addressV4(), and sock. |
|
Called when someone connected to our port.
Definition at line 400 of file ksock.cpp. References accepted(), KExtendedSocket::fd(), kdWarning(), KExtendedSocket::release(), and sock. Referenced by bindAndListen(). |
|
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.
Referenced by slotAccept(). |
Member Data Documentation
|
The file descriptor for this socket. sock may be -1. This indicates that it is not connected. Definition at line 335 of file ksock.h. Referenced by bindAndListen(), ipv4_addr(), port(), and slotAccept(). |
The documentation for this class was generated from the following files: