Files
yttrium-virtio-gpu/viosock/vioconnect.py
T
Ilya Rudakov 4f5f7ee1b8 viosock: Add simple host-side tests
Vioconnect.py and violisten.py are very primitive client and server
running on the host to check basic virtio socket functionality.
Cid:port pair is hardocoded as 3:401, use the same port parameter to
run virtiolib-test.exe in the guest to check connectivity. Vioconnect tries
to upload viosock.inf file by default, modify code or put this file along
with vioconnect.py. Violisten recv and store any data as viosock.inf.
Use python3.8 to run scripts.

Signed-off-by: Ilya Rudakov <[email protected]>
2021-03-11 11:12:53 +02:00

21 lines
366 B
Python

#!/usr/bin/python
import socket
import os, os.path
import time
from collections import deque
with open('viosock.inf') as f:
read_data = f.read()
client = socket.socket(socket.AF_VSOCK, socket.SOCK_STREAM)
client.connect((3,401))
client.send(read_data.encode('utf-8'))
packet = client.recv(65536)
if packet:
print('Recv: ' + str(packet))
client.close()