old_gravity/client.py

49 lines
1.2 KiB
Python
Raw Normal View History

2020-01-27 16:21:31 +01:00
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Sun Jan 26 17:50:16 2020
@author: suwako
"""
import sys, pygame, time, random, socket
from colorama import Fore, Style
import numpy as np
def debug(*s): print("[D ] : " +
str(', '.join(map(str, s))) +
Style.RESET_ALL)
def info(*s): print(Fore.GREEN +
Fore.LIGHTGREEN_EX +
"[I -] : " +
Style.RESET_ALL +
str(', '.join(map(str, s))) +
Style.RESET_ALL)
def warn(*s): print(Fore.MAGENTA +
"[W ~] : " +
Style.RESET_ALL +
str(', '.join(map(str, s))) +
Style.RESET_ALL)
def error(*s): print(Fore.RED +
Fore.LIGHTRED_EX +
"[E !] : " +
Style.RESET_ALL +
str(', '.join(map(str, s))) +
Style.RESET_ALL)
if __name__ == "__main__":
sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
sock.connect(("localhost", 9000))
data = b"some data"
sock.sendall(data)
result = sock.recv(1024)
print(result)
sock.close()