17 lines
466 B
Python
17 lines
466 B
Python
import socket
|
|
|
|
client_socket = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
|
|
|
|
server_address = input("address to connect to: ")
|
|
server_port = input("port to connect through: ")
|
|
|
|
client_socket.connect((server_address, int(server_port)))
|
|
|
|
while 1:
|
|
transmission = input("text to send: ")
|
|
client_socket.send(transmission.encode('utf-8'))
|
|
response = client_socket.recv(8192).decode('utf-8')
|
|
print("server replied: " + response)
|
|
|
|
client_socket.close()
|