The QServerSocket class provides a TCP-based server. More...
#include <qserversocket.h>
Inherits QObject.
This class is a convenience class for accepting incoming TCP connections. You can specify port or have QSocketServer pick one, and listen on just one address or on all the addresses of the machine.
The API is very simple: Subclass it, call the constructor of your choice, and implement newConnection() to handle new incoming connections. There is nothing more to do.
(Note that due to lack of support in the underlying APIs, QServerSocket cannot accept or reject connections conditionally.)
See also: QSocket, QSocketDevice, QSocketAddress and QSocketNotifier.
Creates a server socket object, that will serve the given port on just address.
The parent and name arguments are passed on as usual to the QObject constructor.
Creates a server socket object, that will serve the given port on all the addresses of this host. If port is 0, QServerSocket picks a suitable port in in a system-dependent manner.
The parent and name arguments are passed on as usual to the QObject constructor.
Destructs the socket.
This brutally severes any backlogged connections (connections that have reached the host, but not yet been completely set up by calling QSocketDevice::accept()).
Existing connections continue to exist; this only affects acceptance of new connections.
Returns the address on which this object listens, or 0.0.0.0 if this object listens on more than one address.
See also: port() and QSocketDevice::address().
[virtual]
This pure virtual function is responsible for setting up a new incoming connection. socket is the fd of the newly accepted connection.
Returns the port number on which this object listens. This is always non-zero; if you specify 0 in the constructor, QServerSocket picks a port itself and port() returns its number.
See also: address() and QSocketDevice::port().
Search the documentation, FAQ, qt-interest archive and more (uses
www.troll.no):
This file is part of the Qt toolkit, copyright © 1995-2000 Troll Tech, all rights reserved.
Copyright İ 2000 Troll Tech | Trademarks | Qt version 2.1.0 (pre-release)
|