DR695H | b911603 | 2019-05-21 11:13:45 -0400 | [diff] [blame] | 1 | import socket |
2 | |||||
3 | |||||
4 | class SocketUtils: | ||||
5 | """SocketUtils is common resource for simple socket keywords.""" | ||||
6 | |||||
7 | def __init__(self): | ||||
8 | pass | ||||
9 | |||||
10 | def send_binary_data(self, host, port, data): | ||||
11 | """ send raw bytes over tcp socket""" | ||||
12 | sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM) | ||||
13 | # Connect to server and send data | ||||
14 | sock.connect((host, int(port))) | ||||
15 | sock.sendall(bytes(data)) |