[50a3f7]: / modules / Socket / SIOManager.py

Download this file

20 lines (17 with data), 632 Bytes

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
#
import socket
class Socket:
def __init__(self):
self.socket = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
self.socket.connect(('35.184.171.249',5010))
print "Successfully connected to through port 5010!"
def socket_send(self,data):
success = self.socket.send(data)
if success == -1:
#error occured while sending data
print "An error occured while sending data"
if success == 0:
#no data was sent/connection could be broken
print "No data was sent through socket."
socket = Socket()
#socket.socket_send("Hello World!")