23 lines
473 B
Python
23 lines
473 B
Python
import socket
|
|
import json
|
|
|
|
client_socket = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
|
|
|
|
server_address = ('localhost', 8081)
|
|
print(f'Connecting to {server_address}...')
|
|
client_socket.connect(server_address)
|
|
|
|
try:
|
|
data = {
|
|
'file': 'filename.tif',
|
|
'rgb': 1000
|
|
}
|
|
|
|
json_data = json.dumps(data)
|
|
|
|
print(f'Sending: {json_data}')
|
|
client_socket.sendall(json_data.encode())
|
|
|
|
finally:
|
|
print('Closing connection')
|
|
client_socket.close() |