本文介绍了有没有办法更不用说miniboa的任何端口号telnet服务器proc的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述 我在TelnetServer proc中提到了端口号。当我提到端口号时效果很好。 当我不提及下面的端口号时,我看到了追溯。 我尝试过: 我已经提到了TelnetServer proc中的端口号。当我提到端口号时效果很好。 当我不提及下面的端口号时,我看到了追溯。 if __name__ =='__ main__': #简单的聊天服务器通过 #async和telnet模块演示连接处理。 logging.basicConfig(level = logging.DEBUG) logger = logging.getLogger('telnet_server') #用端口,地址创建一个telnet服务器, #用新连接调用的函数 #和一个用丢失连接调用的函数。 telnet_server = TelnetServer( port ='',#####有没有办法在这里提及端口号? address ='', on_connect = on_connect, on_disconnect = on_disconnect, timeout = .05 b $ b) 回溯(最近一次调用最后一次): 文件/bootflash/telnet_server_1.py,第173行,< module> timeout = .05 文件/usr/lib/python2.7/site-packages/miniboa/async.py,第80行,在__init__ server_socket.bind ((地址,端口)) 文件/usr/lib64/python2.7/socket.py,第224行,in meth TypeError:需要一个整数I have mentioned the port number in the TelnetServer proc. It works well when I mention port number.When I dont mention the port number like below, I see the traceback.What I have tried:I have mentioned the port number in the TelnetServer proc. It works well when I mention port number.When I dont mention the port number like below, I see the traceback.if __name__ == '__main__': # Simple chat server to demonstrate connection handling via the # async and telnet modules. logging.basicConfig(level=logging.DEBUG) logger = logging.getLogger('telnet_server') # Create a telnet server with a port, address, # a function to call with new connections # and one to call with lost connections. telnet_server = TelnetServer( port='', ##### is there any way not to mention the port number here? address='', on_connect=on_connect, on_disconnect=on_disconnect, timeout = .05 )Traceback (most recent call last): File "/bootflash/telnet_server_1.py", line 173, in <module> timeout = .05 File "/usr/lib/python2.7/site-packages/miniboa/async.py", line 80, in __init__ server_socket.bind((address, port)) File "/usr/lib64/python2.7/socket.py", line 224, in methTypeError: an integer is required推荐答案 因为端口号是第一个参数,所以只有在使用所有参数的默认值时才能这样做(使用 telnet_server = TelnetServer()) )。 然后根据 miniboa 1.0.1使用端口7777: Python包索引 [ ^ ])。 服务器应用程序必须侦听绑定到特定端口的套接字,并且客户端必须在他想要连接时指定相同的端口。这是网络连接的基本原则。Because the port number is the first parameter this can be only done when using the defaults for all parameters (using telnet_server = TelnetServer()).Then port 7777 will be used according to miniboa 1.0.1 : Python Package Index[^]). A server application must listen on a socket bound to a specific port and a client must specify the same port when he wants to connect. This is a fundamental principle of network connections. 这篇关于有没有办法更不用说miniboa的任何端口号telnet服务器proc的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!
10-28 02:11