Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 9 years ago.
Improve this question
I am running Linux Fedora 18 and all I want is my java code to print hello linux in a web browser I type in http:// myhostname. I have use my code in windows and it work find. However in Linux I use port 80 got a permission denied. So I then I use port 8080 no permission denied but it didn't work. Using port 80 the client dose accept and I can send and receive information only on machine the seversocket not on a different even if it is connect ton the network.Last thing I have made policy file to allow port 80 to work but it was useless and I still not sure I to set a policy file in my code. Sorry if this long question but I have been researching this issue for a month not so please don't tell me to google it. So I guess my main question why can't the serverSocket broadcast anything out of the linux machine and how to fix it?
Thank you
On Linux, you need to be root to use system ports from 0 to 1023. Tomcat has ways of opening port 80 without leaving the process running as root, but they are a bit complicated to discuss here. Linux provides ways to give permissions to access these port, but usually I just use port 8080.
If you use port 8080, you need to redirect this using your router to port 80, or you will have to specify that you want to connect to port 8080. Your browser only assumes port 80. e.g. http://yourhost:8080/
To connect to this server from another machine, your firewalls have to be setup so you connect to it all. A firewall is designed to stop traffic you haven't explicitly allowed. This means you may need to open your firewall on your server, and you network router and put the your public IP address (not your internal one) in the hosts file of your client.
I did a yum update and the code work just fine now.
Related
Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
This question does not appear to be about a specific programming problem, a software algorithm, or software tools primarily used by programmers. If you believe the question would be on-topic on another Stack Exchange site, you can leave a comment to explain where the question may be able to be answered.
Closed 3 years ago.
Improve this question
I am using a java program on Lubuntu which backs up my windows computer through Wi-Fi LAN. I need to access to his windows shared folder but with PC-NAME, not with IP Address. How can I do that?
I am using cifs utils to achieve that and for permanent mount it is in /etc/fstab:
//PCName/ShareF /media/PCName/ShareF cifs credentials=/home/user/.myrcre
But I get this error:
mount error: could not resolve address for PCName: Unknown error
I need to access the windows PC through its name, not ip address, because I dont want to set the static ip, and because of that, the IP address changes sometimes. I need it mounted permanently, no matter if server or client is shuted down.
Maybe, it is here some another possibility, e.g. java code could obtain IP address from PCName, but I dont know why. Cant find anything.
Thank you for any answer.
First of all, Lubuntu needs to know who is PCName, so ping it from terminal and verify:
ping PCName
If you can resolve PCName to XXX.YYY.KKK.ZZZ, you can mount it.
If you can't resolve the name, Lubuntu can't mount an undefined network resource and i suppose that it's your case:
mount error: could not resolve address for PCName
This is a network question, not really a programming question.
Have you a Domain Server or a DNS server in the network?
If you have it, on your Lubuntu PC set the DNS server to that ip and try to resolve PCName again. Lubuntu will be able to resolve PCName asking to the server (DNS or DC).
Have you access to the DHCP server (on the router I suppose) ?
If you have it, you can map you PCName's MAC address to a particular fixed address. Your Windows PC is still in DHCP but it receive always the same ip.
On Lubuntu add a row in /etc/hosts and the trick is done.
Can't you apply those solutions? ARP-scanning
If you know your Windows PCName's mac address, you can make an ARP scan on the network.
You'll receive a map IP -> MAC so from MAC you get the IP. Now, you can mount your PCName by his IP.
This solution may fail if a firewall, an antivirus software or a IPS block the arp-scanning.
Remember : you can do all linux commands throw Runtime.exec, read this other question. If you can do it in Linux, you can do it in Java
Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 6 years ago.
Improve this question
Ok, so I am a little bit stuck with this problem and could really use some guidance...I have a java application that I have written in Java on eclipse and I also have a database created in mySQL on the same computer, now say I want to copy my java application to another computer on a different network but connect to that same database on my original computer on mySQL, what modifications do I have to make so I can connect to my database on different networks and areas? any guidance or help would be greatly appreciated. Beginner in Java and Databases so please try to explain thoroughly.
Since you use a pure JDBC application you simply need to set the JDBC URL to match with your requirements knowing that the format is something like:
jdbc:mysql://[host1][:port1][,[host2][:port2]]...[/[database]][?propertyName1=propertyValue1[&propertyName2=propertyValue2]...]
So assuming that your hostname is foo and the port is 3306, the first thing that you will have to do is to change the current JDBC URL of your application for something like jdbc:mysql://foo:3306 (assuming that your host is accessible from the other computer and you configured your firewall to accept connections on the port of your database).
More info here
For the second part of the job to do (assuming that you have a static IP address), you will need to configure a port forwarding rule at your internet modem level such that any access to your public IP on a given port will be directly routed to the local IP address of your machine on the mysql port. Check the documentation of your modem to know how to do such thing. Here is more info about port forwarding
Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 9 years ago.
Improve this question
I am getting this error when i try to make script in bash which copy OAF personalization from one serwer to another. Here is my code:
java oracle.jrad.tools.xml.importer.XMLImporter /ORACLE/apps/apps_st/comn/html_personal/oracle/apps/eng/changemgmt/webui/customizations/site/0/UserAttributesPG.xml
-username apps
-password apps
-dbconnection "(DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST= 172.30.32.222)(PORT=22))(CONNECT_DATA=(SID=SRV)))"
-rootdir ORACLE/apps/apps_st/comn/html_personal/oracle/apps/eng/changemgmt/webui/customizations/site/0/
Any ideas?
You are connecting to port 22, which is traditionally reserved for ssh. If I connect to that port with a JDBC connection I get the same error stack you showed in your previous question:
Exception in thread "main" java.lang.StringIndexOutOfBoundsException: String index out of range: 25978
at java.lang.String.checkBounds(String.java:401)
at java.lang.String.<init>(String.java:338)
at oracle.net.ns.Packet.extractData(Packet.java:429)
at oracle.net.ns.RefusePacket.<init>(RefusePacket.java:72)
at oracle.net.ns.NSProtocol.connect(NSProtocol.java:356)
at oracle.jdbc.driver.T4CConnection.connect(T4CConnection.java:1102)
at oracle.jdbc.driver.T4CConnection.logon(T4CConnection.java:320)
at oracle.jdbc.driver.PhysicalConnection.<init>(PhysicalConnection.java:546)
at oracle.jdbc.driver.T4CConnection.<init>(T4CConnection.java:236)
at oracle.jdbc.driver.T4CDriverExtension.getConnection(T4CDriverExtension.java:32)
at oracle.jdbc.driver.OracleDriver.connect(OracleDriver.java:521)
at oracle.jdbc.pool.OracleDataSource.getPhysicalConnection(OracleDataSource.java:280)
at oracle.jdbc.pool.OracleDataSource.getConnection(OracleDataSource.java:207)
at oracle.jdbc.pool.OracleDataSource.getConnection(OracleDataSource.java:157)
Well, slightly different stack because of how I'm connecting and the version I'm using, but the String index is identical. Looks like ssh is responding to the connection with more data that the JDBC driver ever expects to see back from a listener.
Changing just the port number to a valid SQL*Net listener port removes this error and the connection succeeds.
So, change to use your listener's actual port number; 1521 by default but you might have something custom. lsnrctl status will tell you what it is. It's unlikely to be 22 even if it is customised since that is in the privileged range and the listener would need to be running as root to bind to it.
The only reason I can think you might have tried this is because you're tunnelling your SQL*Net connection over ssh, to a remote server. If that is the case then you need to use the local port (from a -L flag) that maps to the actual listener port on the remote server. So if you had, say, ssh -L 1234:127.0.0.1:1521 -l user 172.30.32.222, your dbconnection would point to localhost and port 1234. I'm speculating as to why you'd have used 22 though, clearly.
Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
This question does not appear to be about a specific programming problem, a software algorithm, or software tools primarily used by programmers. If you believe the question would be on-topic on another Stack Exchange site, you can leave a comment to explain where the question may be able to be answered.
Closed 9 years ago.
Improve this question
I have my laptop that is connected to Internet through my Android mobile which is having its hotspot application running. Now my laptop must have been provided with private ip and my mobile is using a public ip address. I am running a web server on this laptop. Now how can I access this web server from my friends laptop which is not a part of the network ?
I mean which ip address should I provide private ip of the laptop or the public ip address of my mobile?
First your need to find out the following two information:
Your laptop's private IP on which your web server listens on. Use ipconfig on windows or ifconfig on linux or mac.
Your public IP (If you don't know how to find this, you could navigate to www.whatismyip.com and it will show you your public IP)
Then setup a port forwarding rule in your router that forwards a port to your laptop's web server's port. It's not a good idea to forward any port to your laptop, so pick one port. This can be the same port as the port your webserver is configured to listed on.
Lets say you have your web server running on 8080 on your laptop, you would setup a port forwarding rule that maps source port 8080 to your laptop's private ip on port 8080.
You then use the public ip along with the port from outside your internal network. E.g. http://xx.xx.xx.xx:8080
If you want to Access the Website outside the Network, you have to use the public ip.
With the private ip you just can Access ist within Your Network.
I recommend you to get a webserver, because your public ip changes with every reconnect, but at least onces in 24h. And most phone providers do not allow server hosting.
Closed. This question is off-topic. It is not currently accepting answers.
Want to improve this question? Update the question so it's on-topic for Stack Overflow.
Closed 9 years ago.
Improve this question
I have a server written in Java which basically awaits requests from different clients and serves their requests. I am running this server from Eclipse. This server is accessible on the local network but I want to be able to access this service from outside the local network. Is there any way to do this please?
P.S. I am a real beginner in these things
you can open a port in the router that leads to the one that the server is listening on. You then connect to your public IP. This ip can be found on
As #Java Player said, the problem is that your router(Nat) denied any incoming packet to your local network...briefly, there is many solutions for this:
Third party server: you must have a dedicated server that plays the role of intermediary, between your client/server programs.
Pros:
Solve completely the problem related to the Nat.
Cons:
In addition of your client, you must code another third party that forward packet to the desired destination.
BTW it gets a little heavy(waste of bandwidth).
Reversed connexion: the server and the client program are reversed, that's mean the client become a server and the server become a client, 'used by most of trojan...
Pros:
Very easy to implement this approach.
cons:
You must at least has an opened port.
Udp hole punching: this approach is used by perhaps all peer2peer solutions(eg: skype, utorrent...).
Pros:
You don't need to any router configuration.
Direct connection between peers.
Cons:
You need also a third party server called STUN server to get informations about your router.
Not all router that works with udp hole punching, you must consider also the first solution.
Writing a hole punching solution is not easy task.
You could also download something like Hamachi and then download Hamachi and sign into your network on the other PCs and Macs (and Linux...which is currently in beta). Then you'll want to be able to access your server on.
Main Hamachi product page
Linux Beta