Blender-Pipeline/network/test_client.py

39 lines
736 B
Python
Raw Normal View History

# GNU General Public License
# This script is for developers of VCStudio. This one is going to simulate the
# VCStudio client. But in a way where you have more control.
# This is a dumb script so deal with it.
import socket
print("What is te IP of the server?")
ip = input("IP: ")
port = 64646
sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
sock.connect((ip, port))
# Now let's talk to the server
while True:
# Simple cycle of receive / write
# RECIEVE
data = sock.recv(1024)
data = data.decode('utf8')
print(data)
# WRITE
message = input(">>> ")
if message == "exit":
exit()
message = bytes(message, 'utf-8')
sock.sendall(message)