|
|
Monitor a port for incoming TCP/IP connections.
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 dont 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.
KServerSocket ( unsigned short int _port )
| KServerSocket |
Constructor.
Parameters:
_port | the port number to monitor for incoming connections. |
KServerSocket ( const char *_path )
| KServerSocket |
Creates a UNIX domain server socket.
~KServerSocket ()
| ~KServerSocket |
[virtual]
Destructor. Closes the socket if it was not already closed.
int socket ()
| socket |
[const]
Get the file descriptor assoziated with the socket.
unsigned short int port ()
| port |
Returns the port number which is being monitored.
unsigned long ipv4_addr ()
| ipv4_addr |
The address.
void slotAccept ( int )
| slotAccept |
[virtual slot]
Called when someone connected to our port.
void accepted ( KSocket* )
| accepted |
[signal]
A connection has been accepted. It is your task to delete the KSocket if it is no longer needed.
bool init ( short unsigned int )
| init |
[protected: ]
bool init ( const char *_path )
| init |
[protected: ]
QSocketNotifier * notifier | notifier |
[protected: ]
int sock | sock |
[protected: ]
int domain | domain |
[protected: ]