Created
July 21, 2019 17:17
-
-
Save HavishNetla/a8f023e8fedfa1d3cb76e18940823a0e to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import socket | |
import time | |
from contextlib import closing | |
HOST = '192.168.1.171' # The server's hostname or IP address | |
PORT = 65432 # The port used by the server | |
with closing(socket.socket(socket.AF_INET, socket.SOCK_STREAM)) as s: | |
print("conectiong") | |
print( s.connect_ex((HOST, PORT))) | |
print("sendong") | |
s.sendall(b'Hello world') | |
t0 = time.time() | |
counter = 0 | |
while True: | |
try: | |
data = s.recv(1024) | |
print('Received', repr(data)) | |
counter = counter + 1 | |
except: | |
print(time.time() - t0) | |
print(counter) | |
sys.exit() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment