B4J Question WebApp Not visible from the internet

hatzisn

Expert
Licensed User
Longtime User
The title says it all.

Here's what I 've done.
1) Built a trial B4J web app in port 51043
2) Created an inbound rule in the firewall only for this port
3) Tested in the browser (http://localhost:51043) -> Works Ok
4) Tested from the phone (connected to WiFi) using the IP of the "server" which is fixed in the local network -> Works Ok
5) Created a port forwarding rule in the router from out Port 51043 to the IP of the "server" (fixed) in Port 51043
6) Tried to connect from the "server" to the "server" using the out IP and port -> Doesn't Work
7) Disconnected my phone from the WiFi and tried to connect to the "server" with the out IP and Port -> Doesn't Work
8) Tried to connect with DDNS just to check -> Doesn't Work

Does it require any special settings in order to be visible from the outside?
 

Philip Chatzigeorgiadis

Active Member
Licensed User
Longtime User
Your set-up seems OK.
May be you can check this, if you are in Greece:
I have a internet connection with dynamic IP. About 2 years ago I had a problem where my Internet Provider (Cosmote), without any prior notice, assigned me with an IP which, apparently, was common for many other users. As a result, I could not access my server from "outside". I found this problem by observing a difference between my external IP (as reported by DuckDNS updater) and the IP my router's management program displayed. I called Cosmote and they gave me back a unique (dynamic) IP.
 
Upvote 0

hatzisn

Expert
Licensed User
Longtime User
The ISP is Forthnet. Could it be the fact that there is also an IIS running which works perfectly? I suppose this has nothing to do with it because locally I can see both webapps and IIS is accessible also from the outside both with IP and DDNS...
 
Upvote 0

hatzisn

Expert
Licensed User
Longtime User
Further more what I also see is that it does not wait to connect and then stops trying but I get this almost immediately (like it refuses to connect):

1580395039384.png
 
Upvote 0

sorex

Expert
Licensed User
Longtime User
Does your provider allow traffic over that port?

Some providers only allow incoming traffic on ports lower than 1024 unless you ask them to forward everything.
 
Upvote 0

hatzisn

Expert
Licensed User
Longtime User
I tried also to move the outside port to 8083

Then xxx.xxx.xxx.xxx:8083 ===> 192.xxx.xxx.xxx:51043 should occur from the port forwarding rule. Nope... Nothing changes.
 
Upvote 0

sorex

Expert
Licensed User
Longtime User
can you disable IIS and try on port 80? that used to work fine, right?
 
Upvote 0

hatzisn

Expert
Licensed User
Longtime User
I have disabled it and have set the jetty server's port to 80 but I get this when I try to start the jetty server:

2020-01-30 17:30:06.008:INFO::main: Logging initialized @232ms to org.eclipse.jetty.util.log.StdErrLog
2020-01-30 17:30:06.201:INFO:eek:ejs.Server:main: jetty-9.4.z-SNAPSHOT; built: 2018-05-03T15:56:21.710Z; git: daa59876e6f384329b122929e70a80934569428c; jvm 1.8.0_162-b12
2020-01-30 17:30:06.241:INFO:eek:ejs.session:main: DefaultSessionIdManager workerName=node0
2020-01-30 17:30:06.241:INFO:eek:ejs.session:main: No SessionScavenger set, using defaults
2020-01-30 17:30:06.244:INFO:eek:ejs.session:main: node0 Scavenging every 660000ms
2020-01-30 17:30:06.301:INFO:eek:ejsh.ContextHandler:main: Started o.e.j.s.ServletContextHandler@7d0587f1{/,file:///C:/B4X/MyCode/B4J/Test_Apps/Examples/WebAppServerExampleNoMySQL/Objects/www/,AVAILABLE}
2020-01-30 17:30:06.305:INFO:eek:ejs.AbstractNCSARequestLog:main: Opened C:\B4X\MyCode\B4J\Test_Apps\Examples\WebAppServerExampleNoMySQL\Objects\logs\b4j-2020_01_30.request.log
main._appstart (java line: 110)
java.net.BindException: Address already in use: bind
at sun.nio.ch.Net.bind0(Native Method)
at sun.nio.ch.Net.bind(Net.java:433)
at sun.nio.ch.Net.bind(Net.java:425)
at sun.nio.ch.ServerSocketChannelImpl.bind(ServerSocketChannelImpl.java:223)
at sun.nio.ch.ServerSocketAdaptor.bind(ServerSocketAdaptor.java:74)
at org.eclipse.jetty.server.ServerConnector.openAcceptChannel(ServerConnector.java:340)
at org.eclipse.jetty.server.ServerConnector.open(ServerConnector.java:308)
at org.eclipse.jetty.server.AbstractNetworkConnector.doStart(AbstractNetworkConnector.java:80)
at org.eclipse.jetty.server.ServerConnector.doStart(ServerConnector.java:244)
at org.eclipse.jetty.util.component.AbstractLifeCycle.start(AbstractLifeCycle.java:68)
at org.eclipse.jetty.server.Server.doStart(Server.java:398)
at org.eclipse.jetty.util.component.AbstractLifeCycle.start(AbstractLifeCycle.java:68)
at anywheresoftware.b4j.object.ServerWrapper.Start(ServerWrapper.java:220)
at b4j.example.main._appstart(main.java:110)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at anywheresoftware.b4a.BA.raiseEvent2(BA.java:91)
at anywheresoftware.b4a.BA.raiseEvent(BA.java:78)
at b4j.example.main.main(main.java:28)
main.main (java line: 28)

and on the browser I get:

1580398635347.png


which disappears when I restart IIS and shows the ASP.NET pages... I suppose a restart is needed when the IIS is off but I am way too tired to continue this now...
 
Upvote 0

hatzisn

Expert
Licensed User
Longtime User
Last edited:
Upvote 0

MicroDrie

Well-Known Member
Licensed User
Longtime User
You see this error message:
This is an error message from the web server. So it looks that you have a two-way connection to the server via your network path. The error says that the requested resource could be found. So if the request is something like aaa.bbb.ccc.ddd:54021/Test it means that de option "/Test" could not be resolved.

By the way jServer: (Version: 3.00) and B4J 8.10 gives the following error message by a misspelled request (/Test) for the correct /test or you refer to a non-existing page function.


Be also aware that equipment, software and PC c.q. laptop (browser) could cache a web page. You can stop the web server, change to other port and restart the web server, request the web page on the new port, stop the web server again, change back to the original port and restart the web server again.
 
Upvote 0
Top