IP Address of PCs connected to my machine

Discussion in 'Java' started by crash.test.dummy, Jan 26, 2006.

  1. Hi,
    I have a Swing application (running on PC1) that listens on a
    specific port, but its not tied up to a particular machine, so any
    machine "can connect" to PC1. It is like a chatroom application that
    anyone can join in and send and receive messages (except that I'm not
    running on the web).

    With this, how do I know the IP addresses (LAN/WAN/frame relay) of
    the machines connected to PC1?

    Thanks for your help.
    crash.test.dummy, Jan 26, 2006
    #1
    1. Advertising

  2. On 26 Jan 2006 08:58:22 -0800, crash.test.dummy wrote:
    > I have a Swing application (running on PC1) that listens on a
    > specific port, but its not tied up to a particular machine, so any
    > machine "can connect" to PC1. It is like a chatroom application that
    > anyone can join in and send and receive messages (except that I'm not
    > running on the web).
    >
    > With this, how do I know the IP addresses (LAN/WAN/frame relay) of
    > the machines connected to PC1?


    Ask the sockets corresponding to each connection you've accepted().
    Socket.getInetAddress() is what you are looking for.

    /gordon

    --
    [ do not email me copies of your followups ]
    g o r d o n + n e w s @ b a l d e r 1 3 . s e
    Gordon Beaton, Jan 26, 2006
    #2
    1. Advertising

  3. I'll try this one. Thanks a lot!
    crash.test.dummy, Jan 26, 2006
    #3
  4. crash.test.dummy

    Tail_Spin Guest

    How about:

    InetAddress a = InetAddress.getByName( "some_url_arg" );

    "Gordon Beaton" <> wrote in message
    news:43d903fc$...
    > On 26 Jan 2006 08:58:22 -0800, crash.test.dummy wrote:
    > > I have a Swing application (running on PC1) that listens on a
    > > specific port, but its not tied up to a particular machine, so any
    > > machine "can connect" to PC1. It is like a chatroom application that
    > > anyone can join in and send and receive messages (except that I'm not
    > > running on the web).
    > >
    > > With this, how do I know the IP addresses (LAN/WAN/frame relay) of
    > > the machines connected to PC1?

    >
    > Ask the sockets corresponding to each connection you've accepted().
    > Socket.getInetAddress() is what you are looking for.
    >
    > /gordon
    >
    > --
    > [ do not email me copies of your followups ]
    > g o r d o n + n e w s @ b a l d e r 1 3 . s e
    Tail_Spin, Jan 29, 2006
    #4
  5. On Sun, 29 Jan 2006 00:10:00 GMT, Tail_Spin wrote:
    > How about:
    >
    > InetAddress a = InetAddress.getByName( "some_url_arg" );


    That would seem to assume that you already know who is connected,
    which I believe was the original question.

    /gordon

    --
    [ do not email me copies of your followups ]
    g o r d o n + n e w s @ b a l d e r 1 3 . s e
    Gordon Beaton, Jan 30, 2006
    #5
  6. crash.test.dummy

    Tail_Spin Guest

    hehehe, just ckeck'n to make sure someone is really paying attention


    "Gordon Beaton" <> wrote in message
    news:43ddc914$...
    > On Sun, 29 Jan 2006 00:10:00 GMT, Tail_Spin wrote:
    > > How about:
    > >
    > > InetAddress a = InetAddress.getByName( "some_url_arg" );

    >
    > That would seem to assume that you already know who is connected,
    > which I believe was the original question.
    >
    > /gordon
    >
    > --
    > [ do not email me copies of your followups ]
    > g o r d o n + n e w s @ b a l d e r 1 3 . s e
    Tail_Spin, Jan 31, 2006
    #6
    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. cux
    Replies:
    2
    Views:
    790
    Jim Lewis
    May 5, 2004
  2. Peter Merwood

    bgcolor attribute not consistent between PCs

    Peter Merwood, Jan 28, 2004, in forum: ASP .Net
    Replies:
    3
    Views:
    359
    Hermit Dave
    Jan 28, 2004
  3. jack

    Can't Read cookies on some PCs

    jack, May 4, 2004, in forum: ASP .Net
    Replies:
    2
    Views:
    316
  4. bob
    Replies:
    3
    Views:
    5,126
    Victor Bazarov
    Mar 1, 2005
  5. John Benson
    Replies:
    4
    Views:
    338
    Frank Bechmann
    Jan 2, 2004
Loading...

Share This Page