Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- class Point:
- def __init__(self):
- self.x = 0
- self.y = 0
- def __init__(self, x, y):
- self.x = x
- self.y = y
- # Server side
- import socket
- import pickle
- host = "localhost"
- port = 10000
- s = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)
- s.bind((host, port))
- data = s.recvfrom(1024)
- print(data)
- import socket
- import pickle
- from Point import *
- host = "localhost"
- port = 10000
- s = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)
- p = Point(10, 20)
- a = pickle.dumps(p)
- s.sendto(a, (host, port))
Add Comment
Please, Sign In to add comment