<ruby id="bdb3f"></ruby>

    <p id="bdb3f"><cite id="bdb3f"></cite></p>

      <p id="bdb3f"><cite id="bdb3f"><th id="bdb3f"></th></cite></p><p id="bdb3f"></p>
        <p id="bdb3f"><cite id="bdb3f"></cite></p>

          <pre id="bdb3f"></pre>
          <pre id="bdb3f"><del id="bdb3f"><thead id="bdb3f"></thead></del></pre>

          <ruby id="bdb3f"><mark id="bdb3f"></mark></ruby><ruby id="bdb3f"></ruby>
          <pre id="bdb3f"><pre id="bdb3f"><mark id="bdb3f"></mark></pre></pre><output id="bdb3f"></output><p id="bdb3f"></p><p id="bdb3f"></p>

          <pre id="bdb3f"><del id="bdb3f"><progress id="bdb3f"></progress></del></pre>

                <ruby id="bdb3f"></ruby>

                合規國際互聯網加速 OSASE為企業客戶提供高速穩定SD-WAN國際加速解決方案。 廣告
                # QLocalServer Class Reference ## [[QtNetwork](index.htm) module] 該QLocalServer類提供了一個基于本地套接字服務器。[More...](#details) 繼承[QObject](qobject.html)。 ### Methods * `__init__ (self, QObject?parent?=?None)` * `close (self)` * `QString errorString (self)` * `QString fullServerName (self)` * `bool hasPendingConnections (self)` * `incomingConnection (self, sip.voidptr?socketDescriptor)` * `bool isListening (self)` * `bool listen (self, QString?name)` * `int maxPendingConnections (self)` * `QLocalSocket nextPendingConnection (self)` * `QAbstractSocket.SocketError serverError (self)` * `QString serverName (self)` * `setMaxPendingConnections (self, int?numConnections)` * `(bool, bool?timedOut) waitForNewConnection (self, int?msecs?=?0)` ### Static Methods * `bool removeServer (QString?name)` ### Qt Signals * `void newConnection ()` * * * ## Detailed Description 該QLocalServer類提供了一個基于本地套接字服務器。 這個類使得它可以接受傳入本地套接字連接。 Call [listen](qlocalserver.html#listen)( )讓服務器開始偵聽在指定的鍵進入的連接。該[newConnection](qlocalserver.html#newConnection)( )信號,然后每個客戶端連接到服務器時發出的。 Call [nextPendingConnection](qlocalserver.html#nextPendingConnection)( )接受掛起的連接作為一個連接[QLocalSocket](qlocalsocket.html)。該函數返回一個指針,指向一個[QLocalSocket](qlocalsocket.html)可以用于與客戶機進行通信。 如果發生錯誤,[serverError](qlocalserver.html#serverError)()返回的錯誤的類型,并且[errorString](qlocalserver.html#errorString)( )可以被調用來獲取發生了什么可讀的描述。 當偵聽連接,服務器正在偵聽的名稱,可通過[serverName](qlocalserver.html#serverName)( ) 。 調用[close](qlocalserver.html#close)( )使得QLocalServer停止偵聽傳入的連接。 雖然QLocalServer是專為一個事件循環使用,它可以使用它沒有之一。在這種情況下,您必須使用[waitForNewConnection](qlocalserver.html#waitForNewConnection)( ) ,這阻止,直到一個連接可用或者超時。 * * * ## Method Documentation ``` QLocalServer.__init__ (self, QObject?parent?=?None) ``` 該_parent_的說法,如果不是沒有,原因_self_通過Qt的,而不是PyQt的擁有。 創建一個新的本地套接字服務器與給定_parent_。 **See also** [listen](qlocalserver.html#listen)( ) 。 ``` QLocalServer.close (self) ``` 停止偵聽傳入的連接。現有的連接將不受影響,但任何新的連接將被拒絕。 **See also** [isListening](qlocalserver.html#isListening)()和[listen](qlocalserver.html#listen)( ) 。 ``` QString QLocalServer.errorString (self) ``` 返回人類可讀的消息恰當報告的當前錯誤[serverError](qlocalserver.html#serverError)( ) 。如果沒有合適的字符串是可用的,則返回一個空字符串。 **See also** [serverError](qlocalserver.html#serverError)( ) 。 ``` QString QLocalServer.fullServerName (self) ``` 返回該服務器監聽的完整路徑。 注:這是具體平臺 **See also** [listen](qlocalserver.html#listen)()和[serverName](qlocalserver.html#serverName)( ) 。 ``` bool QLocalServer.hasPendingConnections (self) ``` 返回True ,如果服務器有一個掛起的連接,否則返回False 。 **See also** [nextPendingConnection](qlocalserver.html#nextPendingConnection)()和[setMaxPendingConnections](qlocalserver.html#setMaxPendingConnections)( ) 。 ``` QLocalServer.incomingConnection (self, sip.voidptr?socketDescriptor) ``` 這個虛函數被調用[QLocalServer](qlocalserver.html)當一個新的連接可用。_socketDescriptor_對于接受連接的本地套接字描述符。 該基地實現創建一個[QLocalSocket](qlocalsocket.html),設置套接字描述符,然后存儲[QLocalSocket](qlocalsocket.html)在掛起連接的內部清單。最后[newConnection](qlocalserver.html#newConnection)()被發射。 重新實現這個函數來改變服務器的行為,當一個連接可用。 **See also** [newConnection](qlocalserver.html#newConnection)( )[nextPendingConnection](qlocalserver.html#nextPendingConnection)()和[QLocalSocket.setSocketDescriptor](qlocalsocket.html#setSocketDescriptor)( ) 。 ``` bool QLocalServer.isListening (self) ``` 如果服務器正在偵聽傳入連接,否則為False ,則返回True 。 **See also** [listen](qlocalserver.html#listen)()和[close](qlocalserver.html#close)( ) 。 ``` bool QLocalServer.listen (self, QString?name) ``` 告訴服務器偵聽傳入的連接_name_。如果服務器當前正在偵聽那么它將返回False 。返回True成功,否則為False 。 _name_可以是單一的名稱和[QLocalServer](qlocalserver.html)將確定正確的特定于平臺的路徑。[serverName](qlocalserver.html#serverName)( )將返回傳遞到聽的名字。 通常你會只是通過像“foo”的名稱,但在Unix上,這也可能是諸如“ / tmp目錄/富”的路徑,在Windows上,這可能是一個管道的路徑,例如“ \ \ \管道\富” 。對于以下路徑的VxWorks必須始終使用“ / comp/socket/0xNumber ”,其中“ 0xNumber ”是十六進制格式的16位數字的字符串表示形式。例如“ / comp/socket/0x00AA ” 。 注意:在Unix上,如果不關閉服務器崩潰聽會失敗, AddressInUseError 。創建該文件應該被刪除新服務器。在Windows兩個本地服務器可以聽同一管道的同時,但任何連接將轉到服務器之一。 **See also** [serverName](qlocalserver.html#serverName)( )[isListening](qlocalserver.html#isListening)()和[close](qlocalserver.html#close)( ) 。 ``` int QLocalServer.maxPendingConnections (self) ``` 返回未決接受的連接的最大數目。默認值是30 。 **See also** [setMaxPendingConnections](qlocalserver.html#setMaxPendingConnections)()和[hasPendingConnections](qlocalserver.html#hasPendingConnections)( ) 。 ``` QLocalSocket QLocalServer.nextPendingConnection (self) ``` [](qlocalsocket.html) [返回的連接下一個待連接](qlocalsocket.html)[QLocalSocket](qlocalsocket.html)對象。 套接字被作為服務器的一個子創建的,這意味著它被自動刪除時[QLocalServer](qlocalserver.html)對象被銷毀。它仍然是一個好主意,明確地刪除的對象,當你用它做,以避免浪費內存。 如果這個函數被調用時,有沒有掛起的連接則返回0 。 **See also** [hasPendingConnections](qlocalserver.html#hasPendingConnections)( )[newConnection](qlocalserver.html#newConnection)()和[incomingConnection](qlocalserver.html#incomingConnection)( ) 。 ``` bool QLocalServer.removeServer (QString?name) ``` 刪除可能導致調用任何服務器實例[listen](qlocalserver.html#listen)()失敗,如果成功返回True,否則返回False 。此功能是為了從崩潰中,當以前的服務器實例還沒有被清理回收。 在Windows中,這個函數不做任何事情;在Unix上,它消除由給定的套接字文件_name_。 **Warning:**要小心,以避免刪除運行實例的插座。 此功能被引入Qt的4.5 。 ``` QAbstractSocket.SocketError QLocalServer.serverError (self) ``` [ 最后返回NOERROR或發生錯誤的類型。 ](qabstractsocket.html#SocketError-enum) [**See also**](qabstractsocket.html#SocketError-enum) [errorString](qlocalserver.html#errorString)( ) 。 ``` QString QLocalServer.serverName (self) ``` 返回如果服務器正在監聽等待連接的服務器名,否則返回的QString ( ) **See also** [listen](qlocalserver.html#listen)()和[fullServerName](qlocalserver.html#fullServerName)( ) 。 ``` QLocalServer.setMaxPendingConnections (self, int?numConnections) ``` 設置掛起接受的最大連接數_numConnections_。[QLocalServer](qlocalserver.html)將接受不超過_numConnections_前傳入的連接[nextPendingConnection](qlocalserver.html#nextPendingConnection)()被調用。 注:即使[QLocalServer](qlocalserver.html)將停止接受新的連接后,它已經達到了掛起連接的最大數量,操作系統可能仍然讓他們在隊列中,這將導致客戶端的信號,它是連通的。 **See also** [maxPendingConnections](qlocalserver.html#maxPendingConnections)()和[hasPendingConnections](qlocalserver.html#hasPendingConnections)( ) 。 ``` (bool, bool?timedOut) QLocalServer.waitForNewConnection (self, int?msecs?=?0) ``` 最多等待_msec_毫秒或直到傳入的連接是可用的。返回True如果連接可用,否則返回False 。如果操作超時,_timedOut_不為0 , * TIMEDOUT將被設置為True。 這是一個阻塞函數調用。它的使用是不明智的單線程GUI應用程序,因為整個應用程序將停止響應,直到函數返回。當沒有事件循環可用waitForNewConnection ( )是最有用。 非阻塞的替代方法是連接到[newConnection](qlocalserver.html#newConnection)()信號。 如果毫秒為-1 ,此功能將不會超時。 **See also** [hasPendingConnections](qlocalserver.html#hasPendingConnections)()和[nextPendingConnection](qlocalserver.html#nextPendingConnection)( ) 。 * * * ## Qt Signal Documentation ``` void newConnection () ``` 這是該信號的默認超載。 每當一個新的連接是可用的,這個信號被發射。 **See also** [hasPendingConnections](qlocalserver.html#hasPendingConnections)()和[nextPendingConnection](qlocalserver.html#nextPendingConnection)( ) 。
                  <ruby id="bdb3f"></ruby>

                  <p id="bdb3f"><cite id="bdb3f"></cite></p>

                    <p id="bdb3f"><cite id="bdb3f"><th id="bdb3f"></th></cite></p><p id="bdb3f"></p>
                      <p id="bdb3f"><cite id="bdb3f"></cite></p>

                        <pre id="bdb3f"></pre>
                        <pre id="bdb3f"><del id="bdb3f"><thead id="bdb3f"></thead></del></pre>

                        <ruby id="bdb3f"><mark id="bdb3f"></mark></ruby><ruby id="bdb3f"></ruby>
                        <pre id="bdb3f"><pre id="bdb3f"><mark id="bdb3f"></mark></pre></pre><output id="bdb3f"></output><p id="bdb3f"></p><p id="bdb3f"></p>

                        <pre id="bdb3f"><del id="bdb3f"><progress id="bdb3f"></progress></del></pre>

                              <ruby id="bdb3f"></ruby>

                              哎呀哎呀视频在线观看