This week's giveaway is in the Android forum.
We're giving away four copies of Android Security Essentials Live Lessons and have Godfrey Nolan on-line!
See this thread for details.
The moose likes Sockets and Internet Protocols and the fly likes can't connect to server via socket Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Java » Sockets and Internet Protocols
Bookmark "can Watch "can New topic
Author

can't connect to server via socket

Adam Krupczynski
Greenhorn

Joined: Apr 18, 2009
Posts: 5
Hi,

I'm trying to create client/server application. I wrote both, compile (client is an applet) and run on my localhost and everything worked fine. Unfortunately, when I uploaded my client and server applications on server I can't connect and get IOException here:


where "host" is a string; it contains external IP of my server.

I tried to sign applet but nothing changed. Is it possible that Ubuntu on that server somehow block socket connection? Maybe I have to add something in java.policy file? I've searched on google and this forum, read a lot of threads but I couldn't find solution. What can be wrong with it?

E: Ok, I dig a little deeper and now I'm getting "Network is unreachable: connect". but still I can't find out how to fix it...
Carey Evans
Ranch Hand

Joined: May 27, 2008
Posts: 225

If it was an applet security problem, like with java.policy, I'd expect you to get an AccessControlException. It could be a firewall problem on the server or the client; you could use nmap to see what ports get through, or try opening the connection from a Java application instead of an applet.
Adam Krupczynski
Greenhorn

Joined: Apr 18, 2009
Posts: 5
Hey,
thanks for answer. Nmap said after scan that port which I'm using to connect is filtered. Currently I'm trying to open any port, because standard

iptables -A INPUT -p tcp --dport _myport_ -j ACCEPT

doesn't work. So it seems that it's not a java problem anymore, but if anyone knows simple way to fix it it would be great .
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: can't connect to server via socket
 
Similar Threads
FTP Upload
How can I close a URLConnection?
FTPSSL and handshake
Sending data to an applet.
applet-servlet communication