I’ve spent quite a bit of time fiddling around trying to create a way to create a LAN connection between two devices on the same network. With all my efforts, all I managed to get to, using SocketHost, was to have app instances on the same device be able to speak to one another. I could not make it work for different devices connecting on the same server.
Does anyone have an idea how to do this, and have an example of their own? I am really curious on how to do this and it seems overly complicated
Have you bound the server to the IP address
0.0.0.0? I think that’s necessary for it to accept connections from other devices.
Are you certain that you are attempting to connect to the correct local IP address? Can you ping that IP address from the device where you want to connect from?
I’d try connecting to the server with
netcat … if that doesn’t work you know that the problem is likely server-side.
(I haven’t used sockets with Haxe yet … this is just general client/server debugging advise.)
If it’s working on one device, but not working between two devices on the same network, it’s likely an IP issue like Martin said, or a firewall… Especially on Windows. I always had to tell Windows to allow my programs through the firewall, or disable it on the local / private network. Some info.
I haven’t worked with sockets in a while… my experience has been - it goes smoother on Linux. But here’s a quick example: https://gist.github.com/jcward/6ff13bceaea25ac4b4b5d2474f72aa01
It worked the same across two devices on the same network: