kidhack Posted October 10, 2017 Posted October 10, 2017 Hi, I created a java servlet to download a m3u file and manage the records. A exception is thrown when I try to download the URL. The URL is correct and the servlet runs successfull in others platforms: java.net.ConnectException: Connection refused (Connection refused) java.net.PlainSocketImpl.socketConnect(Native Method) java.net.AbstractPlainSocketImpl.doConnect(AbstractPlainSocketImpl.java:350) java.net.AbstractPlainSocketImpl.connectToAddress(AbstractPlainSocketImpl.java:206) java.net.AbstractPlainSocketImpl.connect(AbstractPlainSocketImpl.java:188) java.net.SocksSocketImpl.connect(SocksSocketImpl.java:392) java.net.Socket.connect(Socket.java:589) java.net.Socket.connect(Socket.java:538) sun.net.NetworkClient.doConnect(NetworkClient.java:180) sun.net.www.http.HttpClient.openServer(HttpClient.java:463) sun.net.www.http.HttpClient.openServer(HttpClient.java:558) sun.net.www.http.HttpClient.<init>(HttpClient.java:242) sun.net.www.http.HttpClient.New(HttpClient.java:339) sun.net.www.http.HttpClient.New(HttpClient.java:357) sun.net.www.protocol.http.HttpURLConnection.getNewHttpClient(HttpURLConnection.java:1202) sun.net.www.protocol.http.HttpURLConnection.plainConnect0(HttpURLConnection.java:1138) sun.net.www.protocol.http.HttpURLConnection.plainConnect(HttpURLConnection.java:1032) sun.net.www.protocol.http.HttpURLConnection.connect(HttpURLConnection.java:966) sun.net.www.protocol.http.HttpURLConnection.getInputStream0(HttpURLConnection.java:1546) sun.net.www.protocol.http.HttpURLConnection.getInputStream(HttpURLConnection.java:1474) java.net.URL.openStream(URL.java:1045) com.avz.servlets.MainServlet.generateTVFile(MainServlet.java:313) com.avz.servlets.MainServlet.doGet(MainServlet.java:54) javax.servlet.http.HttpServlet.service(HttpServlet.java:622) javax.servlet.http.HttpServlet.service(HttpServlet.java:729) org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52)
kidhack Posted October 10, 2017 Author Posted October 10, 2017 My servlet is under the normal http port (80). The URL to download in my servlet is in the port 8000.
Krydos Posted October 10, 2017 Posted October 10, 2017 You won't be able to connect to port 8000 because that port is blocked in our firewall.
kidhack Posted October 10, 2017 Author Posted October 10, 2017 Wow, and is not possible to open it in my servlet? The URL cant change to other port😥
Krydos Posted October 10, 2017 Posted October 10, 2017 Here's a link to the last guy who set up a java servlet web socket. https://www.helionet.org/index/topic/29870-java-websocket-on-tommy-default-ports-debugging-general-help/ Does that help you?
kidhack Posted October 10, 2017 Author Posted October 10, 2017 Thanks but my incoming port is 80, I need that the servlet can call outputs URLs that have 8000 as port... The thread that you indicates to me is to set a different port in the incoming calls? URL m3uUrl = new URL("http://primitivos.mine.nu:8000/get.php?username=USER&password=PASS&type=m3u_plus&output=mpegts");BufferedReader in = new BufferedReader(new InputStreamReader(m3uUrl.openStream(), StandardCharsets.UTF_8)); This code fails in the first second line trying access to the m3uUrl. I don't know if the thread can help me or only refers to the incoming port. Thanks a lot
Krydos Posted October 10, 2017 Posted October 10, 2017 It sounds like you need an outbound port not that your socket is listening on port 8000 like I thought. I see that you're connecting to a dynamic dns domain which is probably a home computer. Can you change the port 8000 to something else?
kidhack Posted October 10, 2017 Author Posted October 10, 2017 I cant change the port, the server is a IP TV service that I hired and return a m3u file that I need download in my servlet. Is not possible to open the 8000 port for outgoing connections? I found this related thread and I think that you solved it😁: https://www.helionet.org/index/topic/11996-a-module-in-my-joomla-webpage-on-heliohost-needs-access-to-tcp-port-8000/
Krydos Posted October 11, 2017 Posted October 11, 2017 What is the destination IP of the outgoing port 8000 tcp data?
kidhack Posted October 11, 2017 Author Posted October 11, 2017 I dont know, I only know the URL. I only need can access to it, please
Krydos Posted October 11, 2017 Posted October 11, 2017 Open a command prompt and type ping <url> and it will say the numerical IP.
kidhack Posted October 11, 2017 Author Posted October 11, 2017 Yes, I know, but im not sure if this domain will have always the same IP... Now, the IP is 147.135.183.212
Recommended Posts