使用Python使用telnet连接到TCP套接字

时间:2019-06-16 01:07:45

标签: python sockets telnet

我创建了套接字,然后与telnet连接,我尝试从telnet发送数据,但是套接字没有将其打印出来

import socket
s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
s.bind(('127.0.0.1', 1111))
print "socket binded to %s" %(1111)
s.listen(50)    
print "socket is listening"
while(True):
    c, addr = s.accept()
    print 'connection: ', addr
    c.send('welcome: ')
    c.recv(1024)
    print 'user: ' + c.recv(20)

我需要它发送所有数据并打印 [img] https://cdn.discordapp.com/attachments/555216558427865089/589621750682353672/unknown.png[/img]

0 个答案:

没有答案