Java Networking

Discussion in 'Java' started by Neo, Sep 16, 2006.

  1. Neo

    Neo Guest

    Hello
    I have written a program in java in which there are two classes
    Server(Server Socket) & Client(Socket). My question is that when I
    create a server socket on my computer, client from any part of the
    world who knows my IP address and port no. can connect to that server
    socket. if not then what is the appropriate solution for them residing
    anywhere on the globe.
    Please any kind of help is really appreciated. I am really in trouble.
    Thanks.
    Neo, Sep 16, 2006
    #1
    1. Advertising

  2. Neo wrote:

    > My question is that when I
    > create a server socket on my computer, client from any part of the
    > world who knows my IP address and port no. can connect to that server
    > socket.


    Depends. You can bind your ServerSocket to a specific network
    that might be restricted only to your local network (127.0.0.1
    for example). The access to your ServerSocket might also be
    restricted by firewalls or other techniques.

    So your question can't be answered simply by yes or no, but if
    you open a ServerSocket without specifying an IP-address, the
    ServerSocket itself is accepting connections coming from all
    network-interfaces. If your clients can reach these interfaces
    you have to check in addition to that.

    > if not then what is the appropriate solution for them residing
    > anywhere on the globe.


    Not sure what you mean, maybe you should question again in a
    more detailed manner, especially what you want to be able to
    do with your application.


    Regards, Lothar
    --
    Lothar Kimmeringer E-Mail:
    PGP-encrypted mails preferred (Key-ID: 0x8BC3CD81)

    Always remember: The answer is forty-two, there can only be wrong
    questions!
    Lothar Kimmeringer, Sep 16, 2006
    #2
    1. Advertising

  3. Neo wrote:
    > Hello
    > I have written a program in java in which there are two classes
    > Server(Server Socket) & Client(Socket). My question is that when I
    > create a server socket on my computer, client from any part of the
    > world who knows my IP address and port no. can connect to that server
    > socket. if not then what is the appropriate solution for them residing
    > anywhere on the globe.
    >

    So what happened when you tried connecting to it:
    - from another process on your computer?
    - from another computer on your network?
    - from a friend's computer?

    Come back here when you've tried this.


    --
    martin@ | Martin Gregorie
    gregorie. | Essex, UK
    org |
    Martin Gregorie, Sep 16, 2006
    #3
  4. Neo

    Neo Guest

    Martin Gregorie wrote:
    > Neo wrote:
    > > Hello
    > > I have written a program in java in which there are two classes
    > > Server(Server Socket) & Client(Socket). My question is that when I
    > > create a server socket on my computer, client from any part of the
    > > world who knows my IP address and port no. can connect to that server
    > > socket. if not then what is the appropriate solution for them residing
    > > anywhere on the globe.
    > >

    > So what happened when you tried connecting to it:
    > - from another process on your computer?
    > - from another computer on your network?
    > - from a friend's computer?

    I have tried in my own computer. It works fine. I have tried on LAN it
    worked fine. Now question is that if i try in on a friend computer or i
    give you my client program and you run on your pc where ever you are
    Will Client and Server be connected. Please help me.|
    Neo, Sep 16, 2006
    #4
  5. Neo wrote:
    > Martin Gregorie wrote:
    >> Neo wrote:
    >>> Hello
    >>> I have written a program in java in which there are two classes
    >>> Server(Server Socket) & Client(Socket). My question is that when I
    >>> create a server socket on my computer, client from any part of the
    >>> world who knows my IP address and port no. can connect to that server
    >>> socket. if not then what is the appropriate solution for them residing
    >>> anywhere on the globe.
    >> >

    >> So what happened when you tried connecting to it:
    >> - from another process on your computer?
    >> - from another computer on your network?
    >> - from a friend's computer?

    > I have tried in my own computer. It works fine. I have tried on LAN it
    > worked fine. Now question is that if i try in on a friend computer or i
    > give you my client program and you run on your pc where ever you are
    > Will Client and Server be connected. Please help me.|
    >


    Yes if there are no firewalls or other restrictions in the way, the
    client, knowing your IP address and the correct port, may connect from
    anywhere on the net. That's how it works :).

    --

    Knute Johnson
    email s/nospam/knute/
    Knute Johnson, Sep 16, 2006
    #5
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Rahul Sharma

    Is there Java.Networking group

    Rahul Sharma, Jul 23, 2003, in forum: Java
    Replies:
    6
    Views:
    400
    Jezuch
    Jul 23, 2003
  2. Robert Olofsson

    Re: Java I/O for Networking

    Robert Olofsson, Aug 22, 2003, in forum: Java
    Replies:
    2
    Views:
    400
    Robert Olofsson
    Aug 24, 2003
  3. VisionSet

    java to java networking

    VisionSet, Nov 19, 2003, in forum: Java
    Replies:
    0
    Views:
    274
    VisionSet
    Nov 19, 2003
  4. Steve R. Burrus

    Need help w. Java Networking.

    Steve R. Burrus, Jun 5, 2004, in forum: Java
    Replies:
    12
    Views:
    758
    Bryce
    Jun 7, 2004
  5. John Galt
    Replies:
    1
    Views:
    690
    zzyzx
    Jul 15, 2004
Loading...

Share This Page