【问题标题】:connecting to a regular socket server from a web socket server (autobahn)从 Web 套接字服务器(高速公路)连接到常规套接字服务器
【发布时间】:2015-03-15 00:40:33
【问题描述】:

我正在编写一个中间网络套接字服务器,以便它可以将消息直接转发到我现有的套接字服务器。

我天真地认为是在

   def onOpen(self):
      #initialize socket client and run in a while true loop

我可以在那里设置套接字客户端并使用while true 永久监听,并对从套接字客户端接收到的任何recv() 数据执行self.sendMessage(...) 返回到websocket 客户端。

这样的东西会起作用吗?有没有更好的方法来做到这一点?我担心的是while true 会屏蔽所有人。

谢谢。

【问题讨论】:

    标签: python sockets websocket autobahn


    【解决方案1】:

    AutobahnPython 已内置。包装任何现有的基于流的协议(例如 VNC、SSH、IRC、IMAP 等) WebSocket - 请参阅here

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2011-03-21
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2017-02-25
      • 2021-08-30
      • 2019-12-10
      相关资源
      最近更新 更多