#!/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()