<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> <!--NewPage--> <HTML> <HEAD> <!-- Generated by javadoc (build 1.5.0_09) on Tue Aug 07 17:07:32 CEST 2007 --> <TITLE> QTcpServer </TITLE> <META NAME="keywords" CONTENT="com.trolltech.qt.network.QTcpServer class"> <LINK REL ="stylesheet" TYPE="text/css" HREF="../../../../stylesheet.css" TITLE="Style"> <SCRIPT type="text/javascript"> function windowTitle() { parent.document.title="QTcpServer"; } </SCRIPT> <NOSCRIPT> </NOSCRIPT> </HEAD> <BODY BGCOLOR="white" onload="windowTitle();"> <!-- ========= START OF TOP NAVBAR ======= --> <A NAME="navbar_top"><!-- --></A> <A HREF="#skip-navbar_top" title="Skip navigation links"></A> <TABLE BORDER="0" WIDTH="100%" CELLPADDING="1" CELLSPACING="0" SUMMARY=""> <TR> <TD COLSPAN=2 BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A NAME="navbar_top_firstrow"><!-- --></A> <TABLE BORDER="0" CELLPADDING="0" CELLSPACING="3" SUMMARY=""> <TR ALIGN="center" VALIGN="top"> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../overview-summary.html"><FONT CLASS="NavBarFont1"><B>Overview</B></FONT></A> </TD> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="package-summary.html"><FONT CLASS="NavBarFont1"><B>Package</B></FONT></A> </TD> <TD BGCOLOR="#FFFFFF" CLASS="NavBarCell1Rev"> <FONT CLASS="NavBarFont1Rev"><B>Class</B></FONT> </TD> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="package-tree.html"><FONT CLASS="NavBarFont1"><B>Tree</B></FONT></A> </TD> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../deprecated-list.html"><FONT CLASS="NavBarFont1"><B>Deprecated</B></FONT></A> </TD> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../index-all.html"><FONT CLASS="NavBarFont1"><B>Index</B></FONT></A> </TD> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../help-doc.html"><FONT CLASS="NavBarFont1"><B>Help</B></FONT></A> </TD> </TR> </TABLE> </TD> <TD ALIGN="right" VALIGN="top" ROWSPAN=3><EM> </EM> </TD> </TR> <TR> <TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2"> <A HREF="../../../../com/trolltech/qt/network/QSsl.SslProtocol.html" title="enum in com.trolltech.qt.network"><B>PREV CLASS</B></A> <A HREF="../../../../com/trolltech/qt/network/QTcpServer.Result.html" title="enum in com.trolltech.qt.network"><B>NEXT CLASS</B></A></FONT></TD> <TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2"> <A HREF="../../../../index.html?com/trolltech/qt/network/QTcpServer.html" target="_top"><B>FRAMES</B></A> <A HREF="QTcpServer.html" target="_top"><B>NO FRAMES</B></A> <SCRIPT type="text/javascript"> <!-- if(window==top) { document.writeln('<A HREF="../../../../allclasses-noframe.html"><B>All Classes</B></A>'); } //--> </SCRIPT> <NOSCRIPT> <A HREF="../../../../allclasses-noframe.html"><B>All Classes</B></A> </NOSCRIPT> </FONT></TD> </TR> <TR> <TD VALIGN="top" CLASS="NavBarCell3"><FONT SIZE="-2"> SUMMARY: <A HREF="#nested_class_summary">NESTED</A> | <A HREF="#field_summary">FIELD</A> | <A HREF="#constructor_summary">CONSTR</A> | <A HREF="#method_summary">METHOD</A></FONT></TD> <TD VALIGN="top" CLASS="NavBarCell3"><FONT SIZE="-2"> DETAIL: <A HREF="#field_detail">FIELD</A> | <A HREF="#constructor_detail">CONSTR</A> | <A HREF="#method_detail">METHOD</A></FONT></TD> </TR> </TABLE> <A NAME="skip-navbar_top"></A> <!-- ========= END OF TOP NAVBAR ========= --> <HR> <!-- ======== START OF CLASS DATA ======== --> <H2> <FONT SIZE="-1"> com.trolltech.qt.network</FONT> <BR> Class QTcpServer</H2> <PRE> java.lang.Object <IMG SRC="../../../../resources/inherit.gif" ALT="extended by "><A HREF="../../../../com/trolltech/qt/QSignalEmitter.html" title="class in com.trolltech.qt">com.trolltech.qt.QSignalEmitter</A> <IMG SRC="../../../../resources/inherit.gif" ALT="extended by "><A HREF="../../../../com/trolltech/qt/QtJambiObject.html" title="class in com.trolltech.qt">com.trolltech.qt.QtJambiObject</A> <IMG SRC="../../../../resources/inherit.gif" ALT="extended by "><A HREF="../../../../com/trolltech/qt/core/QObject.html" title="class in com.trolltech.qt.core">com.trolltech.qt.core.QObject</A> <IMG SRC="../../../../resources/inherit.gif" ALT="extended by "><B>com.trolltech.qt.network.QTcpServer</B> </PRE> <DL> <DT><B>All Implemented Interfaces:</B> <DD><A HREF="../../../../com/trolltech/qt/QtJambiInterface.html" title="interface in com.trolltech.qt">QtJambiInterface</A></DD> </DL> <HR> <DL> <DT><PRE>public class <B>QTcpServer</B><DT>extends <A HREF="../../../../com/trolltech/qt/core/QObject.html" title="class in com.trolltech.qt.core">QObject</A></DL> </PRE> <P> <p>The <a href="QTcpServer.html#QTcpServer(com.trolltech.qt.core.QObject)"><tt>QTcpServer</tt></a> class provides a TCP-based server.</p> <p>This class makes it possible to accept incoming TCP connections. You can specify the port or have <a href="QTcpServer.html#QTcpServer(com.trolltech.qt.core.QObject)"><tt>QTcpServer</tt></a> pick one automatically. You can listen on a specific address or on all the machine's addresses.</p> <p>Call listen() to have the server listen for incoming connections. The <a href="QTcpServer.html#newConnection()"><tt>newConnection</tt></a> signal is then emitted each time a client connects to the server.</p> <p>Call <a href="QTcpServer.html#nextPendingConnection()"><tt>nextPendingConnection</tt></a> to accept the pending connection as a connected <a href="QTcpSocket.html"><tt>QTcpSocket</tt></a>. The function returns a pointer to a <a href="QTcpSocket.html"><tt>QTcpSocket</tt></a> in QAbstractSocket::ConnectedState that you can use for communicating with the client.</p> <p>If an error occurs, <a href="QTcpServer.html#serverError()"><tt>serverError</tt></a> returns the type of error, and <a href="QTcpServer.html#errorString()"><tt>errorString</tt></a> can be called to get a human readable description of what happened.</p> <p>When listening for connections, the address and port on which the server is listening are available as <a href="QTcpServer.html#serverAddress()"><tt>serverAddress</tt></a> and serverPort().</p> <p>Calling <a href="QTcpServer.html#close()"><tt>close</tt></a> makes <a href="QTcpServer.html#QTcpServer(com.trolltech.qt.core.QObject)"><tt>QTcpServer</tt></a> stop listening for incoming connections.</p> <p>Although <a href="QTcpServer.html#QTcpServer(com.trolltech.qt.core.QObject)"><tt>QTcpServer</tt></a> is mostly designed for use with an event loop, it's possible to use it without one. In that case, you must use waitForNewConnection(), which blocks until either a connection is available or a timeout expires.</p> <P> <P> <DL> <DT><B>See Also:</B><DD><a href="QTcpSocket.html"><tt>QTcpSocket</tt></a>, <CODE>Server Example</tt></CODE>, <CODE>Fortune Server Example</tt></CODE>, <CODE>Example</tt></CODE>, <CODE>Example</tt></CODE></DL> <HR> <P> <!-- ======== NESTED CLASS SUMMARY ======== --> <A NAME="nested_class_summary"><!-- --></A> <TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY=""> <TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor"> <TH ALIGN="left" COLSPAN="2"><FONT SIZE="+2"> <B>Nested Class Summary</B></FONT></TH> </TR> <TR BGCOLOR="white" CLASS="TableRowColor"> <TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"> <CODE>static class</CODE></FONT></TD> <TD><CODE><B><A HREF="../../../../com/trolltech/qt/network/QTcpServer.Result.html" title="enum in com.trolltech.qt.network">QTcpServer.Result</A></B></CODE> <BR> </TD> </TR> </TABLE> <A NAME="nested_classes_inherited_from_class_com.trolltech.qt.QSignalEmitter"><!-- --></A> <TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY=""> <TR BGCOLOR="#EEEEFF" CLASS="TableSubHeadingColor"> <TH ALIGN="left"><B>Nested classes/interfaces inherited from class com.trolltech.qt.<A HREF="../../../../com/trolltech/qt/QSignalEmitter.html" title="class in com.trolltech.qt">QSignalEmitter</A></B></TH> </TR> <TR BGCOLOR="white" CLASS="TableRowColor"> <TD><CODE><A HREF="../../../../com/trolltech/qt/QSignalEmitter.Signal0.html" title="class in com.trolltech.qt">QSignalEmitter.Signal0</A>, <A HREF="../../../../com/trolltech/qt/QSignalEmitter.Signal1.html" title="class in com.trolltech.qt">QSignalEmitter.Signal1</A><<A HREF="../../../../com/trolltech/qt/QSignalEmitter.Signal1.html" title="type parameter in QSignalEmitter.Signal1">A</A>>, <A HREF="../../../../com/trolltech/qt/QSignalEmitter.Signal2.html" title="class in com.trolltech.qt">QSignalEmitter.Signal2</A><<A HREF="../../../../com/trolltech/qt/QSignalEmitter.Signal2.html" title="type parameter in QSignalEmitter.Signal2">A</A>,<A HREF="../../../../com/trolltech/qt/QSignalEmitter.Signal2.html" title="type parameter in QSignalEmitter.Signal2">B</A>>, <A HREF="../../../../com/trolltech/qt/QSignalEmitter.Signal3.html" title="class in com.trolltech.qt">QSignalEmitter.Signal3</A><<A HREF="../../../../com/trolltech/qt/QSignalEmitter.Signal3.html" title="type parameter in QSignalEmitter.Signal3">A</A>,<A HREF="../../../../com/trolltech/qt/QSignalEmitter.Signal3.html" title="type parameter in QSignalEmitter.Signal3">B</A>,<A HREF="../../../../com/trolltech/qt/QSignalEmitter.Signal3.html" title="type parameter in QSignalEmitter.Signal3">C</A>>, <A HREF="../../../../com/trolltech/qt/QSignalEmitter.Signal4.html" title="class in com.trolltech.qt">QSignalEmitter.Signal4</A><<A HREF="../../../../com/trolltech/qt/QSignalEmitter.Signal4.html" title="type parameter in QSignalEmitter.Signal4">A</A>,<A HREF="../../../../com/trolltech/qt/QSignalEmitter.Signal4.html" title="type parameter in QSignalEmitter.Signal4">B</A>,<A HREF="../../../../com/trolltech/qt/QSignalEmitter.Signal4.html" title="type parameter in QSignalEmitter.Signal4">C</A>,<A HREF="../../../../com/trolltech/qt/QSignalEmitter.Signal4.html" title="type parameter in QSignalEmitter.Signal4">D</A>>, <A HREF="../../../../com/trolltech/qt/QSignalEmitter.Signal5.html" title="class in com.trolltech.qt">QSignalEmitter.Signal5</A><<A HREF="../../../../com/trolltech/qt/QSignalEmitter.Signal5.html" title="type parameter in QSignalEmitter.Signal5">A</A>,<A HREF="../../../../com/trolltech/qt/QSignalEmitter.Signal5.html" title="type parameter in QSignalEmitter.Signal5">B</A>,<A HREF="../../../../com/trolltech/qt/QSignalEmitter.Signal5.html" title="type parameter in QSignalEmitter.Signal5">C</A>,<A HREF="../../../../com/trolltech/qt/QSignalEmitter.Signal5.html" title="type parameter in QSignalEmitter.Signal5">D</A>,<A HREF="../../../../com/trolltech/qt/QSignalEmitter.Signal5.html" title="type parameter in QSignalEmitter.Signal5">E</A>>, <A HREF="../../../../com/trolltech/qt/QSignalEmitter.Signal6.html" title="class in com.trolltech.qt">QSignalEmitter.Signal6</A><<A HREF="../../../../com/trolltech/qt/QSignalEmitter.Signal6.html" title="type parameter in QSignalEmitter.Signal6">A</A>,<A HREF="../../../../com/trolltech/qt/QSignalEmitter.Signal6.html" title="type parameter in QSignalEmitter.Signal6">B</A>,<A HREF="../../../../com/trolltech/qt/QSignalEmitter.Signal6.html" title="type parameter in QSignalEmitter.Signal6">C</A>,<A HREF="../../../../com/trolltech/qt/QSignalEmitter.Signal6.html" title="type parameter in QSignalEmitter.Signal6">D</A>,<A HREF="../../../../com/trolltech/qt/QSignalEmitter.Signal6.html" title="type parameter in QSignalEmitter.Signal6">E</A>,<A HREF="../../../../com/trolltech/qt/QSignalEmitter.Signal6.html" title="type parameter in QSignalEmitter.Signal6">F</A>>, <A HREF="../../../../com/trolltech/qt/QSignalEmitter.Signal7.html" title="class in com.trolltech.qt">QSignalEmitter.Signal7</A><<A HREF="../../../../com/trolltech/qt/QSignalEmitter.Signal7.html" title="type parameter in QSignalEmitter.Signal7">A</A>,<A HREF="../../../../com/trolltech/qt/QSignalEmitter.Signal7.html" title="type parameter in QSignalEmitter.Signal7">B</A>,<A HREF="../../../../com/trolltech/qt/QSignalEmitter.Signal7.html" title="type parameter in QSignalEmitter.Signal7">C</A>,<A HREF="../../../../com/trolltech/qt/QSignalEmitter.Signal7.html" title="type parameter in QSignalEmitter.Signal7">D</A>,<A HREF="../../../../com/trolltech/qt/QSignalEmitter.Signal7.html" title="type parameter in QSignalEmitter.Signal7">E</A>,<A HREF="../../../../com/trolltech/qt/QSignalEmitter.Signal7.html" title="type parameter in QSignalEmitter.Signal7">F</A>,<A HREF="../../../../com/trolltech/qt/QSignalEmitter.Signal7.html" title="type parameter in QSignalEmitter.Signal7">G</A>>, <A HREF="../../../../com/trolltech/qt/QSignalEmitter.Signal8.html" title="class in com.trolltech.qt">QSignalEmitter.Signal8</A><<A HREF="../../../../com/trolltech/qt/QSignalEmitter.Signal8.html" title="type parameter in QSignalEmitter.Signal8">A</A>,<A HREF="../../../../com/trolltech/qt/QSignalEmitter.Signal8.html" title="type parameter in QSignalEmitter.Signal8">B</A>,<A HREF="../../../../com/trolltech/qt/QSignalEmitter.Signal8.html" title="type parameter in QSignalEmitter.Signal8">C</A>,<A HREF="../../../../com/trolltech/qt/QSignalEmitter.Signal8.html" title="type parameter in QSignalEmitter.Signal8">D</A>,<A HREF="../../../../com/trolltech/qt/QSignalEmitter.Signal8.html" title="type parameter in QSignalEmitter.Signal8">E</A>,<A HREF="../../../../com/trolltech/qt/QSignalEmitter.Signal8.html" title="type parameter in QSignalEmitter.Signal8">F</A>,<A HREF="../../../../com/trolltech/qt/QSignalEmitter.Signal8.html" title="type parameter in QSignalEmitter.Signal8">G</A>,<A HREF="../../../../com/trolltech/qt/QSignalEmitter.Signal8.html" title="type parameter in QSignalEmitter.Signal8">H</A>>, <A HREF="../../../../com/trolltech/qt/QSignalEmitter.Signal9.html" title="class in com.trolltech.qt">QSignalEmitter.Signal9</A><<A HREF="../../../../com/trolltech/qt/QSignalEmitter.Signal9.html" title="type parameter in QSignalEmitter.Signal9">A</A>,<A HREF="../../../../com/trolltech/qt/QSignalEmitter.Signal9.html" title="type parameter in QSignalEmitter.Signal9">B</A>,<A HREF="../../../../com/trolltech/qt/QSignalEmitter.Signal9.html" title="type parameter in QSignalEmitter.Signal9">C</A>,<A HREF="../../../../com/trolltech/qt/QSignalEmitter.Signal9.html" title="type parameter in QSignalEmitter.Signal9">D</A>,<A HREF="../../../../com/trolltech/qt/QSignalEmitter.Signal9.html" title="type parameter in QSignalEmitter.Signal9">E</A>,<A HREF="../../../../com/trolltech/qt/QSignalEmitter.Signal9.html" title="type parameter in QSignalEmitter.Signal9">F</A>,<A HREF="../../../../com/trolltech/qt/QSignalEmitter.Signal9.html" title="type parameter in QSignalEmitter.Signal9">G</A>,<A HREF="../../../../com/trolltech/qt/QSignalEmitter.Signal9.html" title="type parameter in QSignalEmitter.Signal9">H</A>,<A HREF="../../../../com/trolltech/qt/QSignalEmitter.Signal9.html" title="type parameter in QSignalEmitter.Signal9">I</A>></CODE></TD> </TR> </TABLE> <!-- =========== FIELD SUMMARY =========== --> <A NAME="field_summary"><!-- --></A> <TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY=""> <TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor"> <TH ALIGN="left" COLSPAN="2"><FONT SIZE="+2"> <B>Field Summary</B></FONT></TH> </TR> <TR BGCOLOR="white" CLASS="TableRowColor"> <TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"> <CODE> <A HREF="../../../../com/trolltech/qt/QSignalEmitter.Signal0.html" title="class in com.trolltech.qt">QSignalEmitter.Signal0</A></CODE></FONT></TD> <TD><CODE><B><A HREF="../../../../com/trolltech/qt/network/QTcpServer.html#newConnection">newConnection</A></B></CODE> <BR> This signal is emitted every time a new connection is available.</TD> </TR> </TABLE> <!-- ======== CONSTRUCTOR SUMMARY ======== --> <A NAME="constructor_summary"><!-- --></A> <TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY=""> <TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor"> <TH ALIGN="left" COLSPAN="2"><FONT SIZE="+2"> <B>Constructor Summary</B></FONT></TH> </TR> <TR BGCOLOR="white" CLASS="TableRowColor"> <TD><CODE><B><A HREF="../../../../com/trolltech/qt/network/QTcpServer.html#QTcpServer()">QTcpServer</A></B>()</CODE> <BR> Equivalent to <a href="QTcpServer.html#QTcpServer(com.trolltech.qt.core.QObject)"><tt>QTcpServer</tt></a>(0).</TD> </TR> <TR BGCOLOR="white" CLASS="TableRowColor"> <TD><CODE><B><A HREF="../../../../com/trolltech/qt/network/QTcpServer.html#QTcpServer(com.trolltech.qt.core.QObject)">QTcpServer</A></B>(<A HREF="../../../../com/trolltech/qt/core/QObject.html" title="class in com.trolltech.qt.core">QObject</A> parent)</CODE> <BR> Constructs a <a href="QTcpServer.html#QTcpServer(com.trolltech.qt.core.QObject)"><tt>QTcpServer</tt></a> object.</TD> </TR> </TABLE> <!-- ========== METHOD SUMMARY =========== --> <A NAME="method_summary"><!-- --></A> <TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY=""> <TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor"> <TH ALIGN="left" COLSPAN="2"><FONT SIZE="+2"> <B>Method Summary</B></FONT></TH> </TR> <TR BGCOLOR="white" CLASS="TableRowColor"> <TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"> <CODE> void</CODE></FONT></TD> <TD><CODE><B><A HREF="../../../../com/trolltech/qt/network/QTcpServer.html#close()">close</A></B>()</CODE> <BR> Closes the server.</TD> </TR> <TR BGCOLOR="white" CLASS="TableRowColor"> <TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"> <CODE> java.lang.String</CODE></FONT></TD> <TD><CODE><B><A HREF="../../../../com/trolltech/qt/network/QTcpServer.html#errorString()">errorString</A></B>()</CODE> <BR> Returns a human readable description of the last error that occurred.</TD> </TR> <TR BGCOLOR="white" CLASS="TableRowColor"> <TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"> <CODE>static <A HREF="../../../../com/trolltech/qt/network/QTcpServer.html" title="class in com.trolltech.qt.network">QTcpServer</A></CODE></FONT></TD> <TD><CODE><B><A HREF="../../../../com/trolltech/qt/network/QTcpServer.html#fromNativePointer(com.trolltech.qt.QNativePointer)">fromNativePointer</A></B>(<A HREF="../../../../com/trolltech/qt/QNativePointer.html" title="class in com.trolltech.qt">QNativePointer</A> nativePointer)</CODE> <BR> This function returns the QTcpServer instance pointed to by nativePointer</TD> </TR> <TR BGCOLOR="white" CLASS="TableRowColor"> <TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"> <CODE> boolean</CODE></FONT></TD> <TD><CODE><B><A HREF="../../../../com/trolltech/qt/network/QTcpServer.html#hasPendingConnections()">hasPendingConnections</A></B>()</CODE> <BR> Returns true if the server has a pending connection; otherwise returns false.</TD> </TR> <TR BGCOLOR="white" CLASS="TableRowColor"> <TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"> <CODE>protected void</CODE></FONT></TD> <TD><CODE><B><A HREF="../../../../com/trolltech/qt/network/QTcpServer.html#incomingConnection(int)">incomingConnection</A></B>(int handle)</CODE> <BR> This virtual function is called by <a href="QTcpServer.html#QTcpServer(com.trolltech.qt.core.QObject)"><tt>QTcpServer</tt></a> when a new connection is available.</TD> </TR> <TR BGCOLOR="white" CLASS="TableRowColor"> <TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"> <CODE> boolean</CODE></FONT></TD> <TD><CODE><B><A HREF="../../../../com/trolltech/qt/network/QTcpServer.html#isListening()">isListening</A></B>()</CODE> <BR> Returns true if the server is currently listening for incoming connections; otherwise returns false.</TD> </TR> <TR BGCOLOR="white" CLASS="TableRowColor"> <TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"> <CODE> boolean</CODE></FONT></TD> <TD><CODE><B><A HREF="../../../../com/trolltech/qt/network/QTcpServer.html#listen(com.trolltech.qt.network.QHostAddress, int)">listen</A></B>(<A HREF="../../../../com/trolltech/qt/network/QHostAddress.html" title="class in com.trolltech.qt.network">QHostAddress</A> address, int port)</CODE> <BR> Tells the server to listen for incoming connections on address <tt>address</tt> and port <tt>port</tt>.</TD> </TR> <TR BGCOLOR="white" CLASS="TableRowColor"> <TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"> <CODE> int</CODE></FONT></TD> <TD><CODE><B><A HREF="../../../../com/trolltech/qt/network/QTcpServer.html#maxPendingConnections()">maxPendingConnections</A></B>()</CODE> <BR> Returns the maximum number of pending accepted connections.</TD> </TR> <TR BGCOLOR="white" CLASS="TableRowColor"> <TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"> <CODE> <A HREF="../../../../com/trolltech/qt/network/QTcpSocket.html" title="class in com.trolltech.qt.network">QTcpSocket</A></CODE></FONT></TD> <TD><CODE><B><A HREF="../../../../com/trolltech/qt/network/QTcpServer.html#nextPendingConnection()">nextPendingConnection</A></B>()</CODE> <BR> Returns the next pending connection as a connected <a href="QTcpSocket.html"><tt>QTcpSocket</tt></a> object.</TD> </TR> <TR BGCOLOR="white" CLASS="TableRowColor"> <TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"> <CODE> <A HREF="../../../../com/trolltech/qt/network/QNetworkProxy.html" title="class in com.trolltech.qt.network">QNetworkProxy</A></CODE></FONT></TD> <TD><CODE><B><A HREF="../../../../com/trolltech/qt/network/QTcpServer.html#proxy()">proxy</A></B>()</CODE> <BR> Returns the network proxy for this socket.</TD> </TR> <TR BGCOLOR="white" CLASS="TableRowColor"> <TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"> <CODE> <A HREF="../../../../com/trolltech/qt/network/QHostAddress.html" title="class in com.trolltech.qt.network">QHostAddress</A></CODE></FONT></TD> <TD><CODE><B><A HREF="../../../../com/trolltech/qt/network/QTcpServer.html#serverAddress()">serverAddress</A></B>()</CODE> <BR> Returns the server's address if the server is listening for connections; otherwise returns QHostAddress::Null.</TD> </TR> <TR BGCOLOR="white" CLASS="TableRowColor"> <TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"> <CODE> <A HREF="../../../../com/trolltech/qt/network/QAbstractSocket.SocketError.html" title="enum in com.trolltech.qt.network">QAbstractSocket.SocketError</A></CODE></FONT></TD> <TD><CODE><B><A HREF="../../../../com/trolltech/qt/network/QTcpServer.html#serverError()">serverError</A></B>()</CODE> <BR> Returns an error code for the last error that occurred.</TD> </TR> <TR BGCOLOR="white" CLASS="TableRowColor"> <TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"> <CODE> int</CODE></FONT></TD> <TD><CODE><B><A HREF="../../../../com/trolltech/qt/network/QTcpServer.html#serverPort()">serverPort</A></B>()</CODE> <BR> Returns the server's port if the server is listening for connections; otherwise, returns 0.</TD> </TR> <TR BGCOLOR="white" CLASS="TableRowColor"> <TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"> <CODE> void</CODE></FONT></TD> <TD><CODE><B><A HREF="../../../../com/trolltech/qt/network/QTcpServer.html#setMaxPendingConnections(int)">setMaxPendingConnections</A></B>(int numConnections)</CODE> <BR> Sets the maximum number of pending accepted connections to <tt>numConnections</tt>.</TD> </TR> <TR BGCOLOR="white" CLASS="TableRowColor"> <TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"> <CODE> void</CODE></FONT></TD> <TD><CODE><B><A HREF="../../../../com/trolltech/qt/network/QTcpServer.html#setProxy(com.trolltech.qt.network.QNetworkProxy)">setProxy</A></B>(<A HREF="../../../../com/trolltech/qt/network/QNetworkProxy.html" title="class in com.trolltech.qt.network">QNetworkProxy</A> networkProxy)</CODE> <BR> Sets the explicit network proxy for this socket to <tt>networkProxy</tt>.</TD> </TR> <TR BGCOLOR="white" CLASS="TableRowColor"> <TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"> <CODE> boolean</CODE></FONT></TD> <TD><CODE><B><A HREF="../../../../com/trolltech/qt/network/QTcpServer.html#setSocketDescriptor(int)">setSocketDescriptor</A></B>(int socketDescriptor)</CODE> <BR> Sets the socket descriptor this server should use when listening for incoming connections to <tt>socketDescriptor</tt>.</TD> </TR> <TR BGCOLOR="white" CLASS="TableRowColor"> <TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"> <CODE> int</CODE></FONT></TD> <TD><CODE><B><A HREF="../../../../com/trolltech/qt/network/QTcpServer.html#socketDescriptor()">socketDescriptor</A></B>()</CODE> <BR> Returns the native socket descriptor the server uses to listen for incoming instructions, or -1 if the server is not listening.</TD> </TR> <TR BGCOLOR="white" CLASS="TableRowColor"> <TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"> <CODE> <A HREF="../../../../com/trolltech/qt/network/QTcpServer.Result.html" title="enum in com.trolltech.qt.network">QTcpServer.Result</A></CODE></FONT></TD> <TD><CODE><B><A HREF="../../../../com/trolltech/qt/network/QTcpServer.html#waitForNewConnection()">waitForNewConnection</A></B>()</CODE> <BR> This is an overloaded method provided for convenience.</TD> </TR> <TR BGCOLOR="white" CLASS="TableRowColor"> <TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"> <CODE> <A HREF="../../../../com/trolltech/qt/network/QTcpServer.Result.html" title="enum in com.trolltech.qt.network">QTcpServer.Result</A></CODE></FONT></TD> <TD><CODE><B><A HREF="../../../../com/trolltech/qt/network/QTcpServer.html#waitForNewConnection(int)">waitForNewConnection</A></B>(int msec)</CODE> <BR> Waits for at most <tt>msec</tt> milliseconds or until an incoming connection is available.</TD> </TR> </TABLE> <A NAME="methods_inherited_from_class_com.trolltech.qt.core.QObject"><!-- --></A> <TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY=""> <TR BGCOLOR="#EEEEFF" CLASS="TableSubHeadingColor"> <TH ALIGN="left"><B>Methods inherited from class com.trolltech.qt.core.<A HREF="../../../../com/trolltech/qt/core/QObject.html" title="class in com.trolltech.qt.core">QObject</A></B></TH> </TR> <TR BGCOLOR="white" CLASS="TableRowColor"> <TD><CODE><A HREF="../../../../com/trolltech/qt/core/QObject.html#blockSignals(boolean)">blockSignals</A>, <A HREF="../../../../com/trolltech/qt/core/QObject.html#childEvent(com.trolltech.qt.core.QChildEvent)">childEvent</A>, <A HREF="../../../../com/trolltech/qt/core/QObject.html#children()">children</A>, <A HREF="../../../../com/trolltech/qt/core/QObject.html#connectSlotsByName()">connectSlotsByName</A>, <A HREF="../../../../com/trolltech/qt/core/QObject.html#customEvent(com.trolltech.qt.core.QEvent)">customEvent</A>, <A HREF="../../../../com/trolltech/qt/core/QObject.html#disposeLater()">disposeLater</A>, <A HREF="../../../../com/trolltech/qt/core/QObject.html#dumpObjectInfo()">dumpObjectInfo</A>, <A HREF="../../../../com/trolltech/qt/core/QObject.html#dumpObjectTree()">dumpObjectTree</A>, <A HREF="../../../../com/trolltech/qt/core/QObject.html#dynamicPropertyNames()">dynamicPropertyNames</A>, <A HREF="../../../../com/trolltech/qt/core/QObject.html#event(com.trolltech.qt.core.QEvent)">event</A>, <A HREF="../../../../com/trolltech/qt/core/QObject.html#eventFilter(com.trolltech.qt.core.QObject, com.trolltech.qt.core.QEvent)">eventFilter</A>, <A HREF="../../../../com/trolltech/qt/core/QObject.html#findChild()">findChild</A>, <A HREF="../../../../com/trolltech/qt/core/QObject.html#findChild(java.lang.Class)">findChild</A>, <A HREF="../../../../com/trolltech/qt/core/QObject.html#findChild(java.lang.Class, java.lang.String)">findChild</A>, <A HREF="../../../../com/trolltech/qt/core/QObject.html#findChildren()">findChildren</A>, <A HREF="../../../../com/trolltech/qt/core/QObject.html#findChildren(java.lang.Class)">findChildren</A>, <A HREF="../../../../com/trolltech/qt/core/QObject.html#findChildren(java.lang.Class, com.trolltech.qt.core.QRegExp)">findChildren</A>, <A HREF="../../../../com/trolltech/qt/core/QObject.html#findChildren(java.lang.Class, java.lang.String)">findChildren</A>, <A HREF="../../../../com/trolltech/qt/core/QObject.html#installEventFilter(com.trolltech.qt.core.QObject)">installEventFilter</A>, <A HREF="../../../../com/trolltech/qt/core/QObject.html#isWidgetType()">isWidgetType</A>, <A HREF="../../../../com/trolltech/qt/core/QObject.html#killTimer(int)">killTimer</A>, <A HREF="../../../../com/trolltech/qt/core/QObject.html#moveToThread(java.lang.Thread)">moveToThread</A>, <A HREF="../../../../com/trolltech/qt/core/QObject.html#objectName()">objectName</A>, <A HREF="../../../../com/trolltech/qt/core/QObject.html#parent()">parent</A>, <A HREF="../../../../com/trolltech/qt/core/QObject.html#property(java.lang.String)">property</A>, <A HREF="../../../../com/trolltech/qt/core/QObject.html#removeEventFilter(com.trolltech.qt.core.QObject)">removeEventFilter</A>, <A HREF="../../../../com/trolltech/qt/core/QObject.html#setObjectName(java.lang.String)">setObjectName</A>, <A HREF="../../../../com/trolltech/qt/core/QObject.html#setParent(com.trolltech.qt.core.QObject)">setParent</A>, <A HREF="../../../../com/trolltech/qt/core/QObject.html#setProperty(java.lang.String, java.lang.Object)">setProperty</A>, <A HREF="../../../../com/trolltech/qt/core/QObject.html#signalsBlocked()">signalsBlocked</A>, <A HREF="../../../../com/trolltech/qt/core/QObject.html#startTimer(int)">startTimer</A>, <A HREF="../../../../com/trolltech/qt/core/QObject.html#thread()">thread</A>, <A HREF="../../../../com/trolltech/qt/core/QObject.html#timerEvent(com.trolltech.qt.core.QTimerEvent)">timerEvent</A></CODE></TD> </TR> </TABLE> <A NAME="methods_inherited_from_class_com.trolltech.qt.QtJambiObject"><!-- --></A> <TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY=""> <TR BGCOLOR="#EEEEFF" CLASS="TableSubHeadingColor"> <TH ALIGN="left"><B>Methods inherited from class com.trolltech.qt.<A HREF="../../../../com/trolltech/qt/QtJambiObject.html" title="class in com.trolltech.qt">QtJambiObject</A></B></TH> </TR> <TR BGCOLOR="white" CLASS="TableRowColor"> <TD><CODE><A HREF="../../../../com/trolltech/qt/QtJambiObject.html#dispose()">dispose</A>, <A HREF="../../../../com/trolltech/qt/QtJambiObject.html#disposed()">disposed</A>, <A HREF="../../../../com/trolltech/qt/QtJambiObject.html#finalize()">finalize</A>, <A HREF="../../../../com/trolltech/qt/QtJambiObject.html#reassignNativeResources(com.trolltech.qt.QtJambiObject, java.lang.Class)">reassignNativeResources</A>, <A HREF="../../../../com/trolltech/qt/QtJambiObject.html#tr(java.lang.String)">tr</A>, <A HREF="../../../../com/trolltech/qt/QtJambiObject.html#tr(java.lang.String, java.lang.String)">tr</A>, <A HREF="../../../../com/trolltech/qt/QtJambiObject.html#tr(java.lang.String, java.lang.String, int)">tr</A></CODE></TD> </TR> </TABLE> <A NAME="methods_inherited_from_class_com.trolltech.qt.QSignalEmitter"><!-- --></A> <TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY=""> <TR BGCOLOR="#EEEEFF" CLASS="TableSubHeadingColor"> <TH ALIGN="left"><B>Methods inherited from class com.trolltech.qt.<A HREF="../../../../com/trolltech/qt/QSignalEmitter.html" title="class in com.trolltech.qt">QSignalEmitter</A></B></TH> </TR> <TR BGCOLOR="white" CLASS="TableRowColor"> <TD><CODE><A HREF="../../../../com/trolltech/qt/QSignalEmitter.html#disconnect()">disconnect</A>, <A HREF="../../../../com/trolltech/qt/QSignalEmitter.html#disconnect(java.lang.Object)">disconnect</A>, <A HREF="../../../../com/trolltech/qt/QSignalEmitter.html#signalSender()">signalSender</A></CODE></TD> </TR> </TABLE> <A NAME="methods_inherited_from_class_java.lang.Object"><!-- --></A> <TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY=""> <TR BGCOLOR="#EEEEFF" CLASS="TableSubHeadingColor"> <TH ALIGN="left"><B>Methods inherited from class java.lang.Object</B></TH> </TR> <TR BGCOLOR="white" CLASS="TableRowColor"> <TD><CODE>clone, equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait</CODE></TD> </TR> </TABLE> <A NAME="methods_inherited_from_class_com.trolltech.qt.QtJambiInterface"><!-- --></A> <TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY=""> <TR BGCOLOR="#EEEEFF" CLASS="TableSubHeadingColor"> <TH ALIGN="left"><B>Methods inherited from interface com.trolltech.qt.<A HREF="../../../../com/trolltech/qt/QtJambiInterface.html" title="interface in com.trolltech.qt">QtJambiInterface</A></B></TH> </TR> <TR BGCOLOR="white" CLASS="TableRowColor"> <TD><CODE><A HREF="../../../../com/trolltech/qt/QtJambiInterface.html#disableGarbageCollection()">disableGarbageCollection</A>, <A HREF="../../../../com/trolltech/qt/QtJambiInterface.html#nativeId()">nativeId</A>, <A HREF="../../../../com/trolltech/qt/QtJambiInterface.html#nativePointer()">nativePointer</A>, <A HREF="../../../../com/trolltech/qt/QtJambiInterface.html#reenableGarbageCollection()">reenableGarbageCollection</A>, <A HREF="../../../../com/trolltech/qt/QtJambiInterface.html#setJavaOwnership()">setJavaOwnership</A></CODE></TD> </TR> </TABLE> <P> <!-- ============ FIELD DETAIL =========== --> <A NAME="field_detail"><!-- --></A> <TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY=""> <TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor"> <TH ALIGN="left" COLSPAN="1"><FONT SIZE="+2"> <B>Field Detail</B></FONT></TH> </TR> </TABLE> <A NAME="newConnection"><!-- --></A><H3> newConnection</H3> <PRE> public final <A HREF="../../../../com/trolltech/qt/QSignalEmitter.Signal0.html" title="class in com.trolltech.qt">QSignalEmitter.Signal0</A> <B>newConnection</B></PRE> <DL> <DD><p>This signal is emitted every time a new connection is available.</p> <dl> <dt><b>Compatible Slot Signature:</b></dt> <dd><tt>void mySlot()</tt></dd> </dl> <dl> <dt><b>See Also:</b></dt> <dd><a href="QTcpServer.html#hasPendingConnections()"><tt>hasPendingConnections</tt></a>, <a href="QTcpServer.html#nextPendingConnection()"><tt>nextPendingConnection</tt></a></dd> </dl> <P> <DL> </DL> </DL> <!-- ========= CONSTRUCTOR DETAIL ======== --> <A NAME="constructor_detail"><!-- --></A> <TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY=""> <TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor"> <TH ALIGN="left" COLSPAN="1"><FONT SIZE="+2"> <B>Constructor Detail</B></FONT></TH> </TR> </TABLE> <A NAME="QTcpServer()"><!-- --></A><H3> QTcpServer</H3> <PRE> public <B>QTcpServer</B>()</PRE> <DL> <DD><p>Equivalent to <a href="QTcpServer.html#QTcpServer(com.trolltech.qt.core.QObject)"><tt>QTcpServer</tt></a>(0). <P> </DL> <HR> <A NAME="QTcpServer(com.trolltech.qt.core.QObject)"><!-- --></A><H3> QTcpServer</H3> <PRE> public <B>QTcpServer</B>(<A HREF="../../../../com/trolltech/qt/core/QObject.html" title="class in com.trolltech.qt.core">QObject</A> parent)</PRE> <DL> <DD><p>Constructs a <a href="QTcpServer.html#QTcpServer(com.trolltech.qt.core.QObject)"><tt>QTcpServer</tt></a> object.</p> <p><tt>parent</tt> is passed to the <a href="%2E%2E/core/%2E%2E/core/QObject.html#QObject(com.trolltech.qt.core.QObject)"><tt>QObject</tt></a> constructor.</p> <P> <DL> <DT><B>See Also:</B><DD><tt>listen</tt>, <a href="QTcpServer.html#setSocketDescriptor(int)"><tt>setSocketDescriptor</tt></a></DL> </DL> <!-- ============ METHOD DETAIL ========== --> <A NAME="method_detail"><!-- --></A> <TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY=""> <TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor"> <TH ALIGN="left" COLSPAN="1"><FONT SIZE="+2"> <B>Method Detail</B></FONT></TH> </TR> </TABLE> <A NAME="close()"><!-- --></A><H3> close</H3> <PRE> public final void <B>close</B>()</PRE> <DL> <DD><p>Closes the server. The server will no longer listen for incoming connections.</p> <P> <DD><DL> <DT><B>See Also:</B><DD><tt>listen</tt></DL> </DD> </DL> <HR> <A NAME="errorString()"><!-- --></A><H3> errorString</H3> <PRE> public final java.lang.String <B>errorString</B>()</PRE> <DL> <DD><p>Returns a human readable description of the last error that occurred.</p> <P> <DD><DL> <DT><B>See Also:</B><DD><a href="QTcpServer.html#serverError()"><tt>serverError</tt></a></DL> </DD> </DL> <HR> <A NAME="isListening()"><!-- --></A><H3> isListening</H3> <PRE> public final boolean <B>isListening</B>()</PRE> <DL> <DD><p>Returns true if the server is currently listening for incoming connections; otherwise returns false.</p> <P> <DD><DL> <DT><B>See Also:</B><DD><tt>listen</tt></DL> </DD> </DL> <HR> <A NAME="maxPendingConnections()"><!-- --></A><H3> maxPendingConnections</H3> <PRE> public final int <B>maxPendingConnections</B>()</PRE> <DL> <DD><p>Returns the maximum number of pending accepted connections. The default is 30.</p> <P> <DD><DL> <DT><B>See Also:</B><DD><a href="QTcpServer.html#setMaxPendingConnections(int)"><tt>setMaxPendingConnections</tt></a>, <a href="QTcpServer.html#hasPendingConnections()"><tt>hasPendingConnections</tt></a></DL> </DD> </DL> <HR> <A NAME="proxy()"><!-- --></A><H3> proxy</H3> <PRE> public final <A HREF="../../../../com/trolltech/qt/network/QNetworkProxy.html" title="class in com.trolltech.qt.network">QNetworkProxy</A> <B>proxy</B>()</PRE> <DL> <DD><p>Returns the network proxy for this socket. By default QNetworkProxy::DefaultProxy is used.</p> <P> <DD><DL> <DT><B>See Also:</B><DD><a href="QTcpServer.html#setProxy(com.trolltech.qt.network.QNetworkProxy)"><tt>setProxy</tt></a>, <a href="QNetworkProxy.html"><tt>QNetworkProxy</tt></a></DL> </DD> </DL> <HR> <A NAME="serverAddress()"><!-- --></A><H3> serverAddress</H3> <PRE> public final <A HREF="../../../../com/trolltech/qt/network/QHostAddress.html" title="class in com.trolltech.qt.network">QHostAddress</A> <B>serverAddress</B>()</PRE> <DL> <DD><p>Returns the server's address if the server is listening for connections; otherwise returns QHostAddress::Null.</p> <P> <DD><DL> <DT><B>See Also:</B><DD><tt>serverPort</tt>, <tt>listen</tt></DL> </DD> </DL> <HR> <A NAME="serverError()"><!-- --></A><H3> serverError</H3> <PRE> public final <A HREF="../../../../com/trolltech/qt/network/QAbstractSocket.SocketError.html" title="enum in com.trolltech.qt.network">QAbstractSocket.SocketError</A> <B>serverError</B>()</PRE> <DL> <DD><p>Returns an error code for the last error that occurred.</p> <P> <DD><DL> <DT><B>See Also:</B><DD><a href="QTcpServer.html#errorString()"><tt>errorString</tt></a></DL> </DD> </DL> <HR> <A NAME="setMaxPendingConnections(int)"><!-- --></A><H3> setMaxPendingConnections</H3> <PRE> public final void <B>setMaxPendingConnections</B>(int numConnections)</PRE> <DL> <DD><p>Sets the maximum number of pending accepted connections to <tt>numConnections</tt>. <a href="QTcpServer.html#QTcpServer(com.trolltech.qt.core.QObject)"><tt>QTcpServer</tt></a> will accept no more than <tt>numConnections</tt> incoming connections before <a href="QTcpServer.html#nextPendingConnection()"><tt>nextPendingConnection</tt></a> is called. By default, the limit is 30 pending connections.</p> <p>Clients may still able to connect after the server has reached its maximum number of pending connections (i.e., <a href="QTcpSocket.html"><tt>QTcpSocket</tt></a> can still emit the connected() signal). <a href="QTcpServer.html#QTcpServer(com.trolltech.qt.core.QObject)"><tt>QTcpServer</tt></a> will stop accepting the new connections, but the operating system may still keep them in queue.</p> <P> <DD><DL> <DT><B>See Also:</B><DD><a href="QTcpServer.html#maxPendingConnections()"><tt>maxPendingConnections</tt></a>, <a href="QTcpServer.html#hasPendingConnections()"><tt>hasPendingConnections</tt></a></DL> </DD> </DL> <HR> <A NAME="setProxy(com.trolltech.qt.network.QNetworkProxy)"><!-- --></A><H3> setProxy</H3> <PRE> public final void <B>setProxy</B>(<A HREF="../../../../com/trolltech/qt/network/QNetworkProxy.html" title="class in com.trolltech.qt.network">QNetworkProxy</A> networkProxy)</PRE> <DL> <DD><p>Sets the explicit network proxy for this socket to <tt>networkProxy</tt>.</p> <p>To disable the use of a proxy for this socket, use the QNetworkProxy::NoProxy proxy type:</p> <pre> server->setProxy(QNetworkProxy::NoProxy);</pre> <P> <DD><DL> <DT><B>See Also:</B><DD><a href="QTcpServer.html#proxy()"><tt>proxy</tt></a>, <a href="QNetworkProxy.html"><tt>QNetworkProxy</tt></a></DL> </DD> </DL> <HR> <A NAME="setSocketDescriptor(int)"><!-- --></A><H3> setSocketDescriptor</H3> <PRE> public final boolean <B>setSocketDescriptor</B>(int socketDescriptor)</PRE> <DL> <DD><p>Sets the socket descriptor this server should use when listening for incoming connections to <tt>socketDescriptor</tt>. Returns true if the socket is set successfully; otherwise returns false.</p> <p>The socket is assumed to be in listening state.</p> <P> <DD><DL> <DT><B>See Also:</B><DD><a href="QTcpServer.html#socketDescriptor()"><tt>socketDescriptor</tt></a>, <a href="QTcpServer.html#isListening()"><tt>isListening</tt></a></DL> </DD> </DL> <HR> <A NAME="socketDescriptor()"><!-- --></A><H3> socketDescriptor</H3> <PRE> public final int <B>socketDescriptor</B>()</PRE> <DL> <DD><p>Returns the native socket descriptor the server uses to listen for incoming instructions, or -1 if the server is not listening.</p> <p>If the server is using <a href="QNetworkProxy.html"><tt>QNetworkProxy</tt></a>, the returned descriptor may not be usable with native socket functions.</p> <P> <DD><DL> <DT><B>See Also:</B><DD><a href="QTcpServer.html#setSocketDescriptor(int)"><tt>setSocketDescriptor</tt></a>, <a href="QTcpServer.html#isListening()"><tt>isListening</tt></a></DL> </DD> </DL> <HR> <A NAME="hasPendingConnections()"><!-- --></A><H3> hasPendingConnections</H3> <PRE> public boolean <B>hasPendingConnections</B>()</PRE> <DL> <DD><p>Returns true if the server has a pending connection; otherwise returns false.</p> <P> <DD><DL> <DT><B>See Also:</B><DD><a href="QTcpServer.html#nextPendingConnection()"><tt>nextPendingConnection</tt></a>, <a href="QTcpServer.html#setMaxPendingConnections(int)"><tt>setMaxPendingConnections</tt></a></DL> </DD> </DL> <HR> <A NAME="incomingConnection(int)"><!-- --></A><H3> incomingConnection</H3> <PRE> protected void <B>incomingConnection</B>(int handle)</PRE> <DL> <DD><p>This virtual function is called by <a href="QTcpServer.html#QTcpServer(com.trolltech.qt.core.QObject)"><tt>QTcpServer</tt></a> when a new connection is available. The <tt>handle</tt> argument is the native socket descriptor for the accepted connection.</p> <p>The base implementation creates a <a href="QTcpSocket.html"><tt>QTcpSocket</tt></a>, sets the socket descriptor and then stores the <a href="QTcpSocket.html"><tt>QTcpSocket</tt></a> in an internal list of pending connections. Finally <a href="QTcpServer.html#newConnection()"><tt>newConnection</tt></a> is emitted.</p> <p>Reimplement this function to alter the server's behavior when a connection is available.</p> <p>If this server is using <a href="QNetworkProxy.html"><tt>QNetworkProxy</tt></a> then the <tt>handle</tt> may not be usable with native socket functions, and should only be used with QTcpSocket::setSocketDescriptor().</p> <P> <DD><DL> <DT><B>See Also:</B><DD><a href="QTcpServer.html#newConnection()"><tt>newConnection</tt></a>, <a href="QTcpServer.html#nextPendingConnection()"><tt>nextPendingConnection</tt></a></DL> </DD> </DL> <HR> <A NAME="nextPendingConnection()"><!-- --></A><H3> nextPendingConnection</H3> <PRE> public <A HREF="../../../../com/trolltech/qt/network/QTcpSocket.html" title="class in com.trolltech.qt.network">QTcpSocket</A> <B>nextPendingConnection</B>()</PRE> <DL> <DD><p>Returns the next pending connection as a connected <a href="QTcpSocket.html"><tt>QTcpSocket</tt></a> object.</p> <p>The socket is created as a child of the server, which means that it is automatically deleted when the <a href="QTcpServer.html#QTcpServer(com.trolltech.qt.core.QObject)"><tt>QTcpServer</tt></a> object is destroyed. It is still a good idea to delete the object explicitly when you are done with it, to avoid wasting memory.</p> <p>0 is returned if this function is called when there are no pending connections.</p> <P> <DD><DL> <DT><B>See Also:</B><DD><a href="QTcpServer.html#hasPendingConnections()"><tt>hasPendingConnections</tt></a></DL> </DD> </DL> <HR> <A NAME="fromNativePointer(com.trolltech.qt.QNativePointer)"><!-- --></A><H3> fromNativePointer</H3> <PRE> public static <A HREF="../../../../com/trolltech/qt/network/QTcpServer.html" title="class in com.trolltech.qt.network">QTcpServer</A> <B>fromNativePointer</B>(<A HREF="../../../../com/trolltech/qt/QNativePointer.html" title="class in com.trolltech.qt">QNativePointer</A> nativePointer)</PRE> <DL> <DD>This function returns the QTcpServer instance pointed to by nativePointer <P> <DD><DL> <DT><B>Parameters:</B><DD><CODE>nativePointer</CODE> - the QNativePointer of which object should be returned.</DL> </DD> </DL> <HR> <A NAME="listen(com.trolltech.qt.network.QHostAddress, int)"><!-- --></A><H3> listen</H3> <PRE> public final boolean <B>listen</B>(<A HREF="../../../../com/trolltech/qt/network/QHostAddress.html" title="class in com.trolltech.qt.network">QHostAddress</A> address, int port)</PRE> <DL> <DD>Tells the server to listen for incoming connections on address <tt>address</tt> and port <tt>port</tt>. If <tt>port</tt> is 0, a port is chosen automatically. If <tt>address</tt> is QHostAddress::Any, the server will listen on all network interfaces. <p> Returns true on success; otherwise returns false. <P> <DD><DL> </DL> </DD> </DL> <HR> <A NAME="serverPort()"><!-- --></A><H3> serverPort</H3> <PRE> public final int <B>serverPort</B>()</PRE> <DL> <DD>Returns the server's port if the server is listening for connections; otherwise, returns 0. <P> <DD><DL> </DL> </DD> </DL> <HR> <A NAME="waitForNewConnection(int)"><!-- --></A><H3> waitForNewConnection</H3> <PRE> public final <A HREF="../../../../com/trolltech/qt/network/QTcpServer.Result.html" title="enum in com.trolltech.qt.network">QTcpServer.Result</A> <B>waitForNewConnection</B>(int msec)</PRE> <DL> <DD>Waits for at most <tt>msec</tt> milliseconds or until an incoming connection is available. Returns true if a connection is available; otherwise returns false. <p> This is a blocking function call. Its use is not adviced in a single-threaded GUI application, since the whole application will stop responding until the function returns. waitForNewConnection() is mostly useful when there is no event loop available. <p> The non-blocking alternative is to connect to the newConnection() signal. <P> <DD><DL> </DL> </DD> </DL> <HR> <A NAME="waitForNewConnection()"><!-- --></A><H3> waitForNewConnection</H3> <PRE> public final <A HREF="../../../../com/trolltech/qt/network/QTcpServer.Result.html" title="enum in com.trolltech.qt.network">QTcpServer.Result</A> <B>waitForNewConnection</B>()</PRE> <DL> <DD>This is an overloaded method provided for convenience. <P> <DD><DL> <DT><B>Returns:</B><DD></DL> </DD> </DL> <!-- ========= END OF CLASS DATA ========= --> <HR> <!-- ======= START OF BOTTOM NAVBAR ====== --> <A NAME="navbar_bottom"><!-- --></A> <A HREF="#skip-navbar_bottom" title="Skip navigation links"></A> <TABLE BORDER="0" WIDTH="100%" CELLPADDING="1" CELLSPACING="0" SUMMARY=""> <TR> <TD COLSPAN=2 BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A NAME="navbar_bottom_firstrow"><!-- --></A> <TABLE BORDER="0" CELLPADDING="0" CELLSPACING="3" SUMMARY=""> <TR ALIGN="center" VALIGN="top"> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../overview-summary.html"><FONT CLASS="NavBarFont1"><B>Overview</B></FONT></A> </TD> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="package-summary.html"><FONT CLASS="NavBarFont1"><B>Package</B></FONT></A> </TD> <TD BGCOLOR="#FFFFFF" CLASS="NavBarCell1Rev"> <FONT CLASS="NavBarFont1Rev"><B>Class</B></FONT> </TD> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="package-tree.html"><FONT CLASS="NavBarFont1"><B>Tree</B></FONT></A> </TD> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../deprecated-list.html"><FONT CLASS="NavBarFont1"><B>Deprecated</B></FONT></A> </TD> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../index-all.html"><FONT CLASS="NavBarFont1"><B>Index</B></FONT></A> </TD> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../help-doc.html"><FONT CLASS="NavBarFont1"><B>Help</B></FONT></A> </TD> </TR> </TABLE> </TD> <TD ALIGN="right" VALIGN="top" ROWSPAN=3><EM> </EM> </TD> </TR> <TR> <TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2"> <A HREF="../../../../com/trolltech/qt/network/QSsl.SslProtocol.html" title="enum in com.trolltech.qt.network"><B>PREV CLASS</B></A> <A HREF="../../../../com/trolltech/qt/network/QTcpServer.Result.html" title="enum in com.trolltech.qt.network"><B>NEXT CLASS</B></A></FONT></TD> <TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2"> <A HREF="../../../../index.html?com/trolltech/qt/network/QTcpServer.html" target="_top"><B>FRAMES</B></A> <A HREF="QTcpServer.html" target="_top"><B>NO FRAMES</B></A> <SCRIPT type="text/javascript"> <!-- if(window==top) { document.writeln('<A HREF="../../../../allclasses-noframe.html"><B>All Classes</B></A>'); } //--> </SCRIPT> <NOSCRIPT> <A HREF="../../../../allclasses-noframe.html"><B>All Classes</B></A> </NOSCRIPT> </FONT></TD> </TR> <TR> <TD VALIGN="top" CLASS="NavBarCell3"><FONT SIZE="-2"> SUMMARY: <A HREF="#nested_class_summary">NESTED</A> | <A HREF="#field_summary">FIELD</A> | <A HREF="#constructor_summary">CONSTR</A> | <A HREF="#method_summary">METHOD</A></FONT></TD> <TD VALIGN="top" CLASS="NavBarCell3"><FONT SIZE="-2"> DETAIL: <A HREF="#field_detail">FIELD</A> | <A HREF="#constructor_detail">CONSTR</A> | <A HREF="#method_detail">METHOD</A></FONT></TD> </TR> </TABLE> <A NAME="skip-navbar_bottom"></A> <!-- ======== END OF BOTTOM NAVBAR ======= --> <HR> </BODY> </HTML>