Network Timeout When Connecting To An Android Server

Report any Hollywood bugs here
Post Reply
PEB
Posts: 535
Joined: Sun Feb 21, 2010 1:28 am

Network Timeout When Connecting To An Android Server

Post by PEB »

Try this server code:

Code: Select all

CreateServer(1)
SystemRequest("Server", "This is the port: "..GetLocalPort(1, #NETWORKSERVER), "OK")

Function p_ClientConnect()
	SystemRequest("Connection Established", "We have connection!", "OK")
EndFunction

InstallEventHandler({OnConnect=p_ClientConnect})

Repeat
	WaitEvent
Forever
For the client just use OpenConnection() with the correct IP address and whatever port is auto-chosen and displayed by the server. This works fine between my Amiga and my wife's Windows machine. But if the server code is run on an Android device, I cannot connect to it with OpenConnection()---I always get a timeout error.

User avatar
airsoftsoftwair
Posts: 4350
Joined: Fri Feb 12, 2010 2:33 pm
Location: Germany
Contact:

Re: Network Timeout When Connecting To An Android Server

Post by airsoftsoftwair »

Hmm, I'm not sure if security restrictions allow Android apps to open ports. What port does it report if you run this code on Android?

PEB
Posts: 535
Joined: Sun Feb 21, 2010 1:28 am

Re: Network Timeout When Connecting To An Android Server

Post by PEB »

It doesn't let you open a low number port (like 25); but if you let it choose a port, it will open one with a number such as 57016.

p-OS
Posts: 123
Joined: Mon Nov 01, 2010 11:56 pm

Re: Network Timeout When Connecting To An Android Server

Post by p-OS »

Could be a Android Firewall issue / security Limitation. Or maybe the port is already used by some other service on the Android device

PEB
Posts: 535
Joined: Sun Feb 21, 2010 1:28 am

Re: Network Timeout When Connecting To An Android Server

Post by PEB »

I suppose it could be an Android Firewall issue. And if that's the case, I'm not sure how/if I can work around it.

Has anyone tried the code at the top of this thread on an Android device? Anyone had success?

plouf
Posts: 137
Joined: Sun Feb 04, 2018 11:51 pm
Location: Athens,Greece

Re: Network Timeout When Connecting To An Android Server

Post by plouf »

hi i modify just to check
i get protocol = 1 (ak ipv4) and i receive "we have connection"
tested hollywood with player 8.0, AndroidOne 9 OS, the port opened was 45291
CreateServer(1)
SystemRequest("Server", "This is the port: "..GetLocalPort(1, #NETWORKSERVER)
..Chr(10).."IP "..GetLocalIP(1,#NETWORKSERVER)
..Chr(10).."Protocol "..GetLocalProtocol(1,#NETWORKSERVER)
, "OK")


Function p_ClientConnect()
SystemRequest("Connection Established", "We have connection!", "OK")
EndFunction

InstallEventHandler({OnConnect=p_ClientConnect})

Repeat
WaitEvent
Forever
Christos

PEB
Posts: 535
Joined: Sun Feb 21, 2010 1:28 am

Re: Network Timeout When Connecting To An Android Server

Post by PEB »

That's great! (Thanks for testing.)
So I guess that means it's a firewall issue on my Android device? Any ideas how to change that (assuming that's the problem)?

plouf
Posts: 137
Joined: Sun Feb 04, 2018 11:51 pm
Location: Athens,Greece

Re: Network Timeout When Connecting To An Android Server

Post by plouf »

i am not aware of firewall in adroid... have you run my test? it is in protocol 1 ?
how certain you are for android IP and the fact that it is connected in local wifi ONLY (4g data are disabled ?)
Christos

PEB
Posts: 535
Joined: Sun Feb 21, 2010 1:28 am

Re: Network Timeout When Connecting To An Android Server

Post by PEB »

I tested it on my wife's Samsung, and it worked immediately. (That was exciting.)

On my Android tablet (where the test failed consistently before), running LineageOS 15.1, I played around with the security settings (not sure exactly what I was doing), and now the test also works on that tablet!

So I'm really not sure why, but now it seems to be working.

Thanks everyone for your feedback and suggestions!

Post Reply