File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Sockets and Internet Protocols and the fly likes Socket not connected when using host ip address. Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Sockets and Internet Protocols
Bookmark "Socket not connected when using host ip address." Watch "Socket not connected when using host ip address." New topic
Author

Socket not connected when using host ip address.

sharin shazizi
Greenhorn

Joined: Mar 23, 2009
Posts: 14
Im using socket on applet. Both client and server using applet. The program works within localhost. But when i tried using different computer in LAN, the socket is not connecting.




the host ip address is 192.168.1.3
client ip add is 192.168.1.2
please help...thank you
Ryan Beckett
Ranch Hand

Joined: Feb 22, 2009
Posts: 192
Use the host name

sharin shazizi
Greenhorn

Joined: Mar 23, 2009
Posts: 14
i tried using the hostname...still doesnt work...is there any other way?
Ryan Beckett
Ranch Hand

Joined: Feb 22, 2009
Posts: 192
See )]InetAddress.getByAddress(byte[] addr) if you want to use an IP address.

Is the server running before you try to connect using the client? Did you try testing the socket connection in the client using Socket.isConnected()?
Swastik Dey
Rancher

Joined: Jan 08, 2009
Posts: 1477
    
    6

Are you able to ping server from your client pc? If yest try to telnet the server from your client on the specified port and make sure its not blocked by any firewall and is running properly.


c:\>telnet <server_ip_addr> <port_num_on_which_the_server_is_running>


Swastik
sharin shazizi
Greenhorn

Joined: Mar 23, 2009
Posts: 14
i tried to telnet and i am able to telnet. the thing is, before this i used basic socket without applet and it can communicate. but when i use the applet, it doesnt work. the applet only works within localhost environment. if i reside client and server on different machine, then it cant connect at all...i don understand why...

Is the server running before you try to connect using the client? Did you try testing the socket connection in the client using Socket.isConnected()?


yup, the server is running before connecting the server.
sharin shazizi
Greenhorn

Joined: Mar 23, 2009
Posts: 14
do you think its realted t Signed Applet? if it is, what should i do?
Ryan Beckett
Ranch Hand

Joined: Feb 22, 2009
Posts: 192
Wow, I totally forget about that. Yeah, applets run in a sandbox (a secure browser environment that restricts an applet privileges). And, one thing I know is not allowed is communication with a server that didn't issue the applet.
sharin shazizi
Greenhorn

Joined: Mar 23, 2009
Posts: 14
Thanks for replying all..i guess im gona hv to keep on trying within less than 5 hours before my system evaluation. cz i seriously dont know how to deal with signed applet. it looks complicated... i don even understand it...
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Socket not connected when using host ip address.