blob: 87faf5de56beec94ad2bb0818884997b622a958b (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
|
import socket
from urllib.parse import urlparse
import numpy as np
remote = "upd://localhost:31415"
url = urlparse(remote)
print(url.hostname)
print(url.port)
sock = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)
sock.connect((url.hostname, url.port))
# sent some text
sock.send(bytes("hello", "ascii"))
arr = np.arange(0, 10)
print(arr)
sock.send(arr.tobytes())
|