久久久久久久av_日韩在线中文_看一级毛片视频_日本精品二区_成人深夜福利视频_武道仙尊动漫在线观看

<legend id='CfwrA'><style id='CfwrA'><dir id='CfwrA'><q id='CfwrA'></q></dir></style></legend>

  • <tfoot id='CfwrA'></tfoot>
      <bdo id='CfwrA'></bdo><ul id='CfwrA'></ul>
    1. <small id='CfwrA'></small><noframes id='CfwrA'>

    2. <i id='CfwrA'><tr id='CfwrA'><dt id='CfwrA'><q id='CfwrA'><span id='CfwrA'><b id='CfwrA'><form id='CfwrA'><ins id='CfwrA'></ins><ul id='CfwrA'></ul><sub id='CfwrA'></sub></form><legend id='CfwrA'></legend><bdo id='CfwrA'><pre id='CfwrA'><center id='CfwrA'></center></pre></bdo></b><th id='CfwrA'></th></span></q></dt></tr></i><div class="qwawimqqmiuu" id='CfwrA'><tfoot id='CfwrA'></tfoot><dl id='CfwrA'><fieldset id='CfwrA'></fieldset></dl></div>

        多處理的 Python ssl 問題

        Python ssl problem with multiprocessing(多處理的 Python ssl 問題)

          • <legend id='ga5WL'><style id='ga5WL'><dir id='ga5WL'><q id='ga5WL'></q></dir></style></legend>
            1. <tfoot id='ga5WL'></tfoot>

                • <bdo id='ga5WL'></bdo><ul id='ga5WL'></ul>
                    <tbody id='ga5WL'></tbody>
                • <i id='ga5WL'><tr id='ga5WL'><dt id='ga5WL'><q id='ga5WL'><span id='ga5WL'><b id='ga5WL'><form id='ga5WL'><ins id='ga5WL'></ins><ul id='ga5WL'></ul><sub id='ga5WL'></sub></form><legend id='ga5WL'></legend><bdo id='ga5WL'><pre id='ga5WL'><center id='ga5WL'></center></pre></bdo></b><th id='ga5WL'></th></span></q></dt></tr></i><div class="qwawimqqmiuu" id='ga5WL'><tfoot id='ga5WL'></tfoot><dl id='ga5WL'><fieldset id='ga5WL'></fieldset></dl></div>
                • <small id='ga5WL'></small><noframes id='ga5WL'>

                  本文介紹了多處理的 Python ssl 問題的處理方法,對大家解決問題具有一定的參考價(jià)值,需要的朋友們下面隨著小編來一起學(xué)習(xí)吧!

                  問題描述

                  限時(shí)送ChatGPT賬號..

                  我想從多個客戶端子進(jìn)程通過 TLS TCP 套接字將數(shù)據(jù)從客戶端發(fā)送到服務(wù)器,因此我與所有子進(jìn)程共享同一個 ssl 套接字.與一個子進(jìn)程通信,但如果我使用多個子進(jìn)程,TLS 服務(wù)器會崩潰并顯示 ssl.SSLError (SSL3_GET_RECORD:decryption failed or bad record mac).

                  I want to send data from a client to the server in a TLS TCP socket from multiple client subprocesses so I share the same ssl socket with all subprocesses. Communication works with one subprocess, but if I use more than one subprocesses, the TLS server crashes with an ssl.SSLError (SSL3_GET_RECORD:decryption failed or bad record mac).

                  更具體:不依賴于哪個進(jìn)程首先調(diào)用SSLSocket.write()方法,但是從這個時(shí)候開始,只有這個進(jìn)程可以調(diào)用它.如果另一個進(jìn)程調(diào)用write(),服務(wù)器會產(chǎn)生上述異常.

                  More specific: It does not depend which process first calls the SSLSocket.write() method, but this process is the only one from this time on which can call it. If another process calls write(), the server will result in the exception described above.

                  我使用了這個基本代碼:

                  I used this basic code:

                  tlsserver.py

                  import socket, ssl
                  
                  def deal_with_client(connstream):
                      data = connstream.read()
                      while data:
                          print data
                          data = connstream.read()
                      connstream.close()
                  
                  bindsocket = socket.socket()
                  bindsocket.bind(('127.0.0.1', 9998))
                  bindsocket.listen(5)
                  
                  while True:
                      newsocket, fromaddr = bindsocket.accept()
                      connstream = ssl.wrap_socket(newsocket,
                                                  server_side=True,
                                                  certfile="srv.crt",
                                                  keyfile="srv.key",
                                                  ssl_version=ssl.PROTOCOL_TLSv1)
                      deal_with_client(connstream)
                  

                  tlsclient.py

                  import socket, ssl
                  import multiprocessing
                  
                  class SubProc:
                      def __init__(self, sock):
                          self.sock = sock
                  
                      def do(self):
                          self.sock.write("Test")
                  
                  s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
                  
                  ssl_sock = ssl.wrap_socket(s)
                  ssl_sock.connect(('127.0.0.1', 9998))
                  
                  print "Connected to", repr(ssl_sock.getpeername())
                  
                  for x in (1,2):
                      subproc = SubProc(ssl_sock)
                      proc = multiprocessing.Process(target=subproc.do)
                  

                  這是回溯:

                  Traceback (most recent call last):
                    File "tlsserver.py", line 21, in <module>
                      deal_with_client(connstream)
                    File "tlsserver.py", line 7, in deal_with_client
                      data = connstream.read()
                    File "/usr/lib64/python2.6/ssl.py", line 136, in read
                      return self._sslobj.read(len)
                  ssl.SSLError: [Errno 1] _ssl.c:1325: error:1408F119:SSL routines:SSL3_GET_RECORD:decryption failed or bad record mac
                  

                  推薦答案

                  問題是您為兩個進(jìn)程重復(fù)使用相同的連接.SSL 加密數(shù)據(jù)的方式使這失敗了——兩個進(jìn)程必須就共享 SSL 連接的狀態(tài)相互通信.即使你確實(shí)讓它工作了,或者如果你沒有使用 SSL,到達(dá)服務(wù)器的數(shù)據(jù)也會一團(tuán)糟;您將無法真正區(qū)分哪些字節(jié)來自哪個進(jìn)程.

                  The problem is that you're re-using the same connection for both processes. The way SSL encrypts data makes this fail -- the two processes would have to communicate with each other about the state of the shared SSL connection. Even if you do make it work, or if you didn't use SSL, the data would arrive at the server all jumbled up; you would have no real way of distinguishing which bytes came from which process.

                  您需要做的是通過在 subproc.do 中建立連接,為每個進(jìn)程提供自己的 SSL 連接.或者,根本不讓子進(jìn)程與服務(wù)器通信,而是與主進(jìn)程通信,并讓主進(jìn)程通過 SSL 連接進(jìn)行中繼.

                  What you need to do is give each process its own SSL connection, by making the connection in subproc.do. Alternatively, don't have the subprocesses communicate with the server at all, but rather communicate with the main process, and have the main process relay it over the SSL connection.

                  這篇關(guān)于多處理的 Python ssl 問題的文章就介紹到這了,希望我們推薦的答案對大家有所幫助,也希望大家多多支持html5模板網(wǎng)!

                  【網(wǎng)站聲明】本站部分內(nèi)容來源于互聯(lián)網(wǎng),旨在幫助大家更快的解決問題,如果有圖片或者內(nèi)容侵犯了您的權(quán)益,請聯(lián)系我們刪除處理,感謝您的支持!

                  相關(guān)文檔推薦

                  What exactly is Python multiprocessing Module#39;s .join() Method Doing?(Python 多處理模塊的 .join() 方法到底在做什么?)
                  Passing multiple parameters to pool.map() function in Python(在 Python 中將多個參數(shù)傳遞給 pool.map() 函數(shù))
                  multiprocessing.pool.MaybeEncodingError: #39;TypeError(quot;cannot serialize #39;_io.BufferedReader#39; objectquot;,)#39;(multiprocessing.pool.MaybeEncodingError: TypeError(cannot serialize _io.BufferedReader object,)) - IT屋-程序員軟件開
                  Python Multiprocess Pool. How to exit the script when one of the worker process determines no more work needs to be done?(Python 多進(jìn)程池.當(dāng)其中一個工作進(jìn)程確定不再需要完成工作時(shí),如何退出腳本?) - IT屋-程序員
                  How do you pass a Queue reference to a function managed by pool.map_async()?(如何將隊(duì)列引用傳遞給 pool.map_async() 管理的函數(shù)?)
                  yet another confusion with multiprocessing error, #39;module#39; object has no attribute #39;f#39;(與多處理錯誤的另一個混淆,“模塊對象沒有屬性“f)
                    <tbody id='zgWyI'></tbody>
                    <legend id='zgWyI'><style id='zgWyI'><dir id='zgWyI'><q id='zgWyI'></q></dir></style></legend>

                    <tfoot id='zgWyI'></tfoot>
                      <bdo id='zgWyI'></bdo><ul id='zgWyI'></ul>
                        <i id='zgWyI'><tr id='zgWyI'><dt id='zgWyI'><q id='zgWyI'><span id='zgWyI'><b id='zgWyI'><form id='zgWyI'><ins id='zgWyI'></ins><ul id='zgWyI'></ul><sub id='zgWyI'></sub></form><legend id='zgWyI'></legend><bdo id='zgWyI'><pre id='zgWyI'><center id='zgWyI'></center></pre></bdo></b><th id='zgWyI'></th></span></q></dt></tr></i><div class="qwawimqqmiuu" id='zgWyI'><tfoot id='zgWyI'></tfoot><dl id='zgWyI'><fieldset id='zgWyI'></fieldset></dl></div>

                            <small id='zgWyI'></small><noframes id='zgWyI'>

                          1. 主站蜘蛛池模板: 国产一区二区三区四区五区加勒比 | 欧美成人手机视频 | 亚洲一区二区在线免费观看 | av资源网站 | 欧美视频二区 | 国产伦精品一区二区三区高清 | 国产精品黄色 | 午夜精品一区二区三区在线观看 | 超碰成人免费 | 91伊人网| 成人免费一级视频 | 久久久91精品国产一区二区三区 | 欧美日韩亚洲国产 | 91 在线| 国产精品国产三级国产播12软件 | 亚洲精品亚洲人成人网 | 成年网站在线观看 | 一区二区三区久久 | 亚洲国产精品一区在线观看 | 欧美视频一区 | 日韩精品一区二区三区中文字幕 | 久久精品a级毛片 | 青青草视频网站 | 欧美一区二区三区在线观看视频 | 日本超碰 | 国产精品一区二区三区四区 | 日本一区二区不卡 | 免费一区在线 | 一区二区三区亚洲精品国 | 欧美在线视频不卡 | 欧美一区二区三区 | 国产精品久久久久国产a级 欧美日韩国产免费 | 中文字幕av亚洲精品一部二部 | 亚洲一区二区三区 | 九九九久久国产免费 | 91视在线国内在线播放酒店 | 欧美日韩三级视频 | 亚洲精品一区二区在线观看 | 婷婷综合色 | 国产精品高潮呻吟久久av黑人 | 天天躁日日躁aaaa视频 |