You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
25 lines
381 B
25 lines
381 B
import socket
|
|
import time
|
|
|
|
ip_port = ("server", 9999)
|
|
data = "0123456789\n"*100
|
|
|
|
c = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
|
|
|
|
try:
|
|
c.connect(ip_port)
|
|
print("Connected.")
|
|
time.sleep(1)
|
|
i=0
|
|
while i<10:
|
|
print("Send:"+data)
|
|
c.send(data.encode())
|
|
i=i+1
|
|
|
|
finally:
|
|
print("Sent. Waiting....")
|
|
|
|
while True:
|
|
time.sleep(0.001)
|
|
|