Results 1 to 3 of 3
  1. #1
    etrynus is offline Member
    Join Date
    Dec 2008
    Posts
    2
    Rep Power
    0

    Default Sockets for computers in wireless network

    Hi, I'm new to Java network programming and was going through Sun's Knock-Knock tutorial for setting up a client-server connection (http colon//java.sun.com/docs/books/tutorial/networking/sockets/clientServer.html).

    Through that, I was able to run the server/client on two computers and get the connection working. However, at this stage, both computers were on the same wireless network, and to create the socket at the client I was using the private IP (192.168.xxx) of the server.

    Is it possible to have this sample program work on two arbitrary computers, for example, both computers having private IPs on two separate wireless networks (sorry my terminology may be wrong here)? I feel that it must be possible since all these P2P applications exist, but the only thing online I've found regarding this is JXTA, which I'm hoping is not the simplest solution to this problem.

    Any help is appreciated.

    Thanks.

  2. #2
    fishtoprecords's Avatar
    fishtoprecords is offline Senior Member
    Join Date
    Jun 2008
    Posts
    571
    Rep Power
    6

    Default

    Yes, you can talk to any two computers in the world connected by some network. Since most of us talk about the Internet and TCP/IP, you can in theory communicate between any two computers using TCP/IP.

    But in these days of firewalls and NAT, its a lot harder. You have to use ports that are sent through the firewalls. (There may be many layers) and you have to have publically accessible TCP/IP addresses for direct connection.

    DNS is how you convert from the names people can remember, like Google to an IP number. Java has nice functions to get numbers from names, names from numbers, etc.

  3. #3
    etrynus is offline Member
    Join Date
    Dec 2008
    Posts
    2
    Rep Power
    0

    Default

    Thanks FTR, do you have any suggestions of what Java classes I should search for in order to create a connection through many layers?

    For example, in the KnockKnock example with two computers on the same private network, I used InetAddress.getLocalHost in order to determine that the server's private IP is (192.168.xxx). Then the Socket constructor takes in this IP.

    However, this is only half the picture in the general case, where we first need to get to the public IP of the wireless router (75.xxx) and then the private IP to get to the specific computer. What Java functions take in both these IPs to create a layered connection, or is there something else to do?

    Thanks.

Similar Threads

  1. How to connect to a wireless nettwork?
    By KjetilB in forum Networking
    Replies: 3
    Last Post: 11-09-2008, 07:56 PM
  2. Java application using sockets!
    By rameshraj in forum Threads and Synchronization
    Replies: 1
    Last Post: 06-11-2008, 06:13 PM
  3. Sending files over sockets!
    By rameshraj in forum Networking
    Replies: 2
    Last Post: 05-30-2008, 10:18 PM
  4. Sockets
    By Zosden in forum Networking
    Replies: 16
    Last Post: 05-27-2008, 04:55 PM
  5. Help with Sockets
    By Eric in forum Networking
    Replies: 3
    Last Post: 12-01-2007, 08:09 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •