class KServerSocket

Monitors a port for incoming TCP/IP connections. More...

Deprecated! use with care
Definition#include <ksock.h>
InheritsQObject (qt) [public ]
List of all Methods
Annotated List
Files
Globals
Hierarchy
Index

Public Methods

Public Slots

Signals

Protected Methods

Protected Members


Detailed Description

Please use the more powerful KExtendedSocket class.

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.

 KServerSocket ( unsigned short int _port, bool _bind = true )

KServerSocket

Constructor.

Parameters:
_portthe port number to monitor for incoming connections.
_bindif false you need to call bindAndListen yourself. This gives you the opportunity to set options on the socket.

 KServerSocket ( const char *_path, bool _bind = true)

KServerSocket

Creates a UNIX domain server socket.

Parameters:
_pathpath used for the socket.
_bindif false you need to call bindAndListen yourself. This gives you the opportunity to set options on the socket.

 ~KServerSocket ()

~KServerSocket

[virtual]

Destructor. Closes the socket if it was not already closed.

bool  bindAndListen ()

bindAndListen

Binds the socket and start listening. This should only be called once when the constructor was called with _bind false.

Returns: true on success. false on error. On error the socket will be closed.

int  socket ()

socket

[const]

Returns the file descriptor associated with the socket. Returns -1 when an error occured during construction or bindAndListen

unsigned short int  port ()

port

Returns the port number which is being monitored.

unsigned long  ipv4_addr ()

ipv4_addr

The address. This is dumb. Don't use it Refer to KExtendedSocket::localAddress(int)

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.

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.

bool  init ( short unsigned int )

init

[protected]

bool  init ( const char *_path )

init

[protected]

int sock

sock

[protected]