
import socket


class Socket:

	TCP = 0
	UDP = 1

	def __init__(self, type):
		if type == self.TCP:
			self.s = socket.socket(socket.AF_INET, socket.SOCK_STREAM, socket.IPPROTO_TCP)
		else:
			self.s = socket.socket(socket.AF_INET, socket.SOCK_DGRAM, socket.IPPROTO_UDP)
		self.s.setblocking(False)
		
	def connect(self, host, port): self.s.connect((host, port))
	def close(self): self.s.close()
	def send(self, data): self.s.sendall(data)
	def recv(self, num):
		try:
			return self.s.recv(num)
		except BlockingIOError:
			pass
			
	def get_address(self): return self.s.getsockname()[0]
	def get_port(self): return self.s.getsockname()[1]

@@ -528,16 +528,237 @@
 ass%0A%09%09%09%0A
+%09def bind(self, addr=(%22%22, 0)): self.s.bind(addr)%0A%09def sendto(self, data, addr): self.s.sendto(data, addr)%0A%09def recvfrom(self, num):%0A%09%09try:%0A%09%09%09return self.s.recvfrom(num)%0A%09%09except BlockingIOError:%0A%09%09%09return None, None%0A%09%09%09%0A
 %09def get

Add a few functions to Socket class