diff options
Diffstat (limited to 'doc/man/man3/tqserversocket.3qt')
-rw-r--r-- | doc/man/man3/tqserversocket.3qt | 142 |
1 files changed, 142 insertions, 0 deletions
diff --git a/doc/man/man3/tqserversocket.3qt b/doc/man/man3/tqserversocket.3qt new file mode 100644 index 000000000..50611e1cb --- /dev/null +++ b/doc/man/man3/tqserversocket.3qt @@ -0,0 +1,142 @@ +'\" t +.TH QServerSocket 3qt "2 February 2007" "Trolltech AS" \" -*- nroff -*- +.\" Copyright 1992-2007 Trolltech ASA. All rights reserved. See the +.\" license file included in the distribution for a complete license +.\" statement. +.\" +.ad l +.nh +.SH NAME +QServerSocket \- TCP-based server +.SH SYNOPSIS +\fC#include <ntqserversocket.h>\fR +.PP +Inherits QObject. +.PP +.SS "Public Members" +.in +1c +.ti -1c +.BI "\fBQServerSocket\fR ( TQ_UINT16 port, int backlog = 1, QObject * parent = 0, const char * name = 0 )" +.br +.ti -1c +.BI "\fBQServerSocket\fR ( const QHostAddress & address, TQ_UINT16 port, int backlog = 1, QObject * parent = 0, const char * name = 0 )" +.br +.ti -1c +.BI "\fBQServerSocket\fR ( QObject * parent = 0, const char * name = 0 )" +.br +.ti -1c +.BI "virtual \fB~QServerSocket\fR ()" +.br +.ti -1c +.BI "bool \fBok\fR () const" +.br +.ti -1c +.BI "TQ_UINT16 \fBport\fR () const" +.br +.ti -1c +.BI "int \fBsocket\fR () const" +.br +.ti -1c +.BI "virtual void \fBsetSocket\fR ( int socket )" +.br +.ti -1c +.BI "QHostAddress \fBaddress\fR () const" +.br +.ti -1c +.BI "virtual void \fBnewConnection\fR ( int socket ) = 0" +.br +.in -1c +.SS "Protected Members" +.in +1c +.ti -1c +.BI "QSocketDevice * \fBsocketDevice\fR ()" +.br +.in -1c +.SH DESCRIPTION +The QServerSocket class provides a TCP-based server. +.PP +This class is a convenience class for accepting incoming TCP connections. You can specify the port or have QServerSocket pick one, and listen on just one address or on all the machine's addresses. +.PP +Using the API is very simple: subclass QServerSocket, call the constructor of your choice, and implement newConnection() to handle new incoming connections. There is nothing more to do. +.PP +(Note that due to lack of support in the underlying APIs, QServerSocket cannot accept or reject connections conditionally.) +.PP +See also QSocket, QSocketDevice, QHostAddress, QSocketNotifier, and Input/Output and Networking. +.SH MEMBER FUNCTION DOCUMENTATION +.SH "QServerSocket::QServerSocket ( TQ_UINT16 port, int backlog = 1, QObject * parent = 0, const char * name = 0 )" +Creates a server socket object, that will serve the given \fIport\fR on all the addresses of this host. If \fIport\fR is 0, QServerSocket will pick a suitable port in a system-dependent manner. Use \fIbacklog\fR to specify how many pending connections the server can have. +.PP +The \fIparent\fR and \fIname\fR arguments are passed on to the QObject constructor. +.PP +\fBWarning:\fR On Tru64 Unix systems a value of 0 for \fIbacklog\fR means that you don't accept any connections at all; you should specify a value larger than 0. +.SH "QServerSocket::QServerSocket ( const QHostAddress & address, TQ_UINT16 port, int backlog = 1, QObject * parent = 0, const char * name = 0 )" +Creates a server socket object, that will serve the given \fIport\fR only on the given \fIaddress\fR. Use \fIbacklog\fR to specify how many pending connections the server can have. +.PP +The \fIparent\fR and \fIname\fR arguments are passed on to the QObject constructor. +.PP +\fBWarning:\fR On Tru64 Unix systems a value of 0 for \fIbacklog\fR means that you don't accept any connections at all; you should specify a value larger than 0. +.SH "QServerSocket::QServerSocket ( QObject * parent = 0, const char * name = 0 )" +Construct an empty server socket. +.PP +This constructor, in combination with setSocket(), allows us to use the QServerSocket class as a wrapper for other socket types (e.g. Unix Domain Sockets under Unix). +.PP +The \fIparent\fR and \fIname\fR arguments are passed on to the QObject constructor. +.PP +See also setSocket(). +.SH "QServerSocket::~QServerSocket ()\fC [virtual]\fR" +Destroys the socket. +.PP +This causes any backlogged connections (connections that have reached the host, but not yet been completely set up by calling QSocketDevice::accept()) to be severed. +.PP +Existing connections continue to exist; this only affects the acceptance of new connections. +.SH "QHostAddress QServerSocket::address () const" +Returns the address on which this object listens, or 0.0.0.0 if this object listens on more than one address. ok() must be TRUE before calling this function. +.PP +See also port() and QSocketDevice::address(). +.SH "void QServerSocket::newConnection ( int socket )\fC [pure virtual]\fR" +This pure virtual function is responsible for setting up a new incoming connection. \fIsocket\fR is the fd (file descriptor) for the newly accepted connection. +.SH "bool QServerSocket::ok () const" +Returns TRUE if the construction succeeded; otherwise returns FALSE. +.SH "TQ_UINT16 QServerSocket::port () const" +Returns the port number on which this server socket listens. This is always non-zero; if you specify 0 in the constructor, QServerSocket will pick a non-zero port itself. ok() must be TRUE before calling this function. +.PP +See also address() and QSocketDevice::port(). +.PP +Example: network/httpd/httpd.cpp. +.SH "void QServerSocket::setSocket ( int socket )\fC [virtual]\fR" +Sets the socket to use \fIsocket\fR. bind() and listen() should already have been called for \fIsocket\fR. +.PP +This allows us to use the QServerSocket class as a wrapper for other socket types (e.g. Unix Domain Sockets). +.SH "int QServerSocket::socket () const" +Returns the operating system socket. +.SH "QSocketDevice * QServerSocket::socketDevice ()\fC [protected]\fR" +Returns a pointer to the internal socket device. The returned pointer is 0 if there is no connection or pending connection. +.PP +There is normally no need to manipulate the socket device directly +since this class does all the necessary setup for most client or +server socket applications. + +.SH "SEE ALSO" +.BR http://doc.trolltech.com/ntqserversocket.html +.BR http://www.trolltech.com/faq/tech.html +.SH COPYRIGHT +Copyright 1992-2007 Trolltech ASA, http://www.trolltech.com. See the +license file included in the distribution for a complete license +statement. +.SH AUTHOR +Generated automatically from the source code. +.SH BUGS +If you find a bug in Qt, please report it as described in +.BR http://doc.trolltech.com/bughowto.html . +Good bug reports help us to help you. Thank you. +.P +The definitive Qt documentation is provided in HTML format; it is +located at $QTDIR/doc/html and can be read using Qt Assistant or with +a web browser. This man page is provided as a convenience for those +users who prefer man pages, although this format is not officially +supported by Trolltech. +.P +If you find errors in this manual page, please report them to +.BR qt-bugs@trolltech.com . +Please include the name of the manual page (tqserversocket.3qt) and the Qt +version (3.3.8). |