#include <ksock.h>
Public Slots | |
| virtual void | slotAccept (int) |
Signals | |
| void | accepted (KSocket *s) |
Public Methods | |
| 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 () |
Protected Attributes | |
| int | sock |
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 241 of file ksock.h.
|
||||||||||||
|
Constructor.
|
|
||||||||||||
|
Creates a UNIX domain server socket.
|
|
|
Destructor. Closes the socket if it was not already closed. |
|
|
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.
|
|
|
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.
|
|
|
Returns the port number which is being monitored.
|
|
|
Called when someone connected to our port. |
|
|
Returns the file descriptor associated with the socket.
Definition at line 281 of file ksock.h. References sock. |
|
|
The file descriptor for this socket. sock may be -1. This indicates that it is not connected. Definition at line 326 of file ksock.h. Referenced by socket(). |
1.2.18