(Python) Bi-directional communication between host and guest

This is for discussing general topics about how to use VirtualBox.
Post Reply
Ohmu
Posts: 18
Joined: 15. Nov 2008, 16:08

(Python) Bi-directional communication between host and guest

Post by Ohmu »

I need to listen for events occurring in my (Windows10) guest, and relay them to my (OSX) host.

I would prefer to use Python on both host and guest.

Can anyone help me get started?

π

PS I'm trying to get an eye-tracker (which only has Windows drivers) working on OSX: http://developer.tobii.com/community/fo ... s-machine/
noteirak
Site Moderator
Posts: 5231
Joined: 13. Jan 2012, 11:14
Primary OS: Debian other
VBox Version: OSE Debian
Guest OSses: Debian, Win 2k8, Win 7
Contact:

Re: (Python) Bi-directional communication between host and g

Post by noteirak »

We need more info if we want to help you:
- Which events?
- What kind of data?
- Are the actions that you want to take from the events only possible in Python?

The generic answer is to use guest properties which allow you to set text values from the guest and get them back from the host.
You don't need python for it, all tools are available from vboxcontrol in the guest and vboxmanage in the host.
Hyperbox - Virtual Infrastructure Manager - https://apps.kamax.lu/hyperbox/
Manage your VirtualBox infrastructure the free way!
Ohmu
Posts: 18
Joined: 15. Nov 2008, 16:08

Re: (Python) Bi-directional communication between host and g

Post by Ohmu »

I'm not yet quite sure exactly what data I need to send.

Certainly I need to send Gaze X&Y coordinates at roughly 60Hz from guest to host.

And this may be sufficient. So maybe I can consider this as a starting point.

I don't need to use Python, it's just a coding preference.

I was imagining setting up an bidirectional JSON transceiver in Python, this would allow arbitrary data to be sent backwards and forwards. But maybe this is overkill!

π
noteirak
Site Moderator
Posts: 5231
Joined: 13. Jan 2012, 11:14
Primary OS: Debian other
VBox Version: OSE Debian
Guest OSses: Debian, Win 2k8, Win 7
Contact:

Re: (Python) Bi-directional communication between host and g

Post by noteirak »

I would strongly advise for regular network communication then. Host-only mode would be a good choice and you don't need to use the API then.
Hyperbox - Virtual Infrastructure Manager - https://apps.kamax.lu/hyperbox/
Manage your VirtualBox infrastructure the free way!
Martin
Volunteer
Posts: 2562
Joined: 30. May 2007, 18:05
Primary OS: Fedora other
VBox Version: VirtualBox+Oracle ExtPack
Guest OSses: XP, Win7, Win10, Linux, OS/2

Re: (Python) Bi-directional communication between host and g

Post by Martin »

If you don't want to create a network connection you could also try if a virtual serial port to a named pipe on the host is sufficient for the communication.
Ohmu
Posts: 18
Joined: 15. Nov 2008, 16:08

Re: (Python) Bi-directional communication between host and g

Post by Ohmu »

So it looks as though I have two options: build a socket transmitter and receiver (which has nothing to do with VirtualBox -- just the same as if I'm connecting 2 computers on a LAN), or using virtual COM port.

Can anyone direct me to any code for the latter? Not quite sure where to start...
noteirak
Site Moderator
Posts: 5231
Joined: 13. Jan 2012, 11:14
Primary OS: Debian other
VBox Version: OSE Debian
Guest OSses: Debian, Win 2k8, Win 7
Contact:

Re: (Python) Bi-directional communication between host and g

Post by noteirak »

About using the COM port, there was already past discussions on the forum about it (even tho I can't find them directly now) so you could find some direction. Just use the internal search or try this search

I will move this topic back into "Using VirtualBox" since this actually has nothing to do with the API itself.
Hyperbox - Virtual Infrastructure Manager - https://apps.kamax.lu/hyperbox/
Manage your VirtualBox infrastructure the free way!
Post Reply