mirror of
https://github.com/asterinas/asterinas.git
synced 2025-06-22 17:03:23 +00:00
Implement vsock driver
This commit is contained in:
committed by
Tate, Hongliang Tian
parent
39c2e17f75
commit
52f808e315
16
test_vsock/vsock_client.py
Normal file
16
test_vsock/vsock_client.py
Normal file
@ -0,0 +1,16 @@
|
||||
import socket
|
||||
|
||||
client_socket = socket.socket(socket.AF_VSOCK, socket.SOCK_STREAM)
|
||||
CID = socket.VMADDR_CID_HOST
|
||||
PORT = 1234
|
||||
vm_cid = 3
|
||||
server_port = 4321
|
||||
client_socket.bind((CID, PORT))
|
||||
client_socket.connect((vm_cid, server_port))
|
||||
|
||||
client_socket.sendall(b'Hello from host')
|
||||
|
||||
response = client_socket.recv(4096)
|
||||
print(f'Received: {response.decode()}')
|
||||
|
||||
client_socket.close()
|
Reference in New Issue
Block a user