livingcomputermuseum / ContrAlto

This repository contains the source code for Living Computers: Museum+Labs's Xerox Alto emulator, ContrAlto.
GNU Affero General Public License v3.0
230 stars 25 forks source link

Emulator to Emulator UDP #5

Closed marciot closed 7 years ago

marciot commented 7 years ago

I'm having a bit of difficulties getting Contralto to speak to another instance of Contralto running on the same Windows 7 machine using UDP (Windows itself is running in a VM with two virtualized NICs connected to the same virtual network). If I connect both emulators to different interfaces and then run Battleship, the first instance finds itself (looks like the broadcast traffic is getting reflected to itself?). If I have both instances associated with the same virtualized NIC, no connection at all takes place.

Earlier I posted that had been successful in getting Battleship to work, but this was in fact using Seth Morabito's recently-released JavaScript port of Contralto (ContraltoJS), which I have been hacking away at to allow for inter-browser communication.

I've been having some trouble getting Maze War to recognize other players, so today I decided to run the native Windows Contralto to see whether things worked here. It doesn't, and neither does Battleship.

So I wonder what I am doing wrong and what is the correct way to set things up for allowing two instances of Contralto running on the same machine to see each other.

-- Marcio

livingcomputermuseum commented 7 years ago

If you're running two instances of ContrAlto on the same virtual machine, you won't be able to talk between the two using UDP; since ContrAlto uses UDP broadcasts it can't open the same socket twice on the same machine. Use Raw Ethernet instead, and have both ContrAlto instances use the same Ethernet interface. (Make sure that interface has a link active, or winpcap gets angry...)

livingcomputermuseum commented 7 years ago

Missed the part where you were connecting it to two separate (virtual) adapters and seeing reflected traffic. I don't know what would account for that; ContrAlto specifically ignores broadcasts from its own address. I assume you have both adapters configured with a unique IP...

At any rate, using raw Ethernet will get you going for now.

marciot commented 7 years ago

On my primary PCs I was unable to install the Microsoft Redistributables because it said I already had a later version and the WinPCap option was grayed out on that PC -- on another PC I was able to install it fine and Contralto was able to reach the peer. Battleship worked fine, as did Maze War.

So I learned what I set off to learn, which is that my rough re-implementation of the Ethernet is botched up in a weird way that Battleship works but Maze War does not. I did take some very liberal shortcuts in my first cut at it (by not implementing the FIFO or the scheduling logic in the Ethernet controller), and I guess that didn't pan out as I had hoped. I'll try a more exact re-implementation of the code later this week.

-- Marcio

marciot commented 7 years ago

I decided to run the UDP tests in the native Contralto again and was able to reproduce the same problem, where the first machine connected to itself. So there seems to be something screwy about running UDP on two NICs on the same host. No biggie, since I already learned to use WinPCap, but I figured I would confirm the problem and double check that it wasn't a fluke. I checked IP addresses, interfaces, and the Alto host ID and everything seemed correct.

The other wierd problem I ran into is that in my Windows 10 VM, the mouse control in Contralto seems to behave like a joystick. The Contralto cursor stays still only if you place the host OS cursor in the exact center of the screen, otherwise it zooms off to a corner. It almost seems like it's an intentional joystick mode, but I can find no toggles in the interface for that. On my native Windows 10 machine, I don't see the mouse behaving like that and the cursor tracks the host cursor. It's perplexing as I don't understand what is different.

marciot commented 7 years ago

Will close the issue since the question about Ethernet between two instances has been answered.

livingcomputermuseum commented 7 years ago

Regarding the mouse cursor issue in the VM, this is a known problem and it has to do with how ContrAlto captures the mouse and how most VM's mouse integration works; essentially the VM's mouse integration defeats the host mouse positioning that ContrAlto is doing and so things behave oddly. If you disable mouse integration in your VM it will behave properly (but then you need to explicitly capture and release the mouse in your VM, which is annoying).

marciot commented 7 years ago

Oh. Interesting. Good to know. Thanks.

marciot commented 7 years ago

Heh. So I guess it comes from running an emulator within an emulator, huh? Sometimes I want to see how deep I can go...