Page 2 of 2 FirstFirst 12
Results 21 to 24 of 24
Like Tree1Likes

Thread: How to return your IP address?

  1. #21
    dougie1809 is offline Senior Member
    Join Date
    Nov 2011
    Posts
    116
    Rep Power
    0

    Default Re: How to return your IP address?

    Quote Originally Posted by Eranga View Post
    As far as I know it is not possible with Java, but you can manage them through sockets. Ports availability and all handles by the OS itself usually.
    Thanks for the reply. Yes i know, im actually using sockets to connect to ports on the local computer which then determines either TCP or UDP ports are opened. I know how to close the socket connection by using the close() method, but there must be a way to actually tell java to close the port that the socket is connected to. That is what im trying to get around, Ive no idea how to do so.

  2. #22
    Tolls is offline Moderator
    Join Date
    Apr 2009
    Posts
    12,006
    Rep Power
    20

    Default Re: How to return your IP address?

    Again, it's up to the OS exactly how the port is reclaimed, it may not be instantaneous.
    Are you finding ports not being closed when a socket is closed?
    Because again that's the OSes job, and it should be fairly quick.
    Please do not ask for code as refusal often offends.

    ** This space for rent **

  3. #23
    dougie1809 is offline Senior Member
    Join Date
    Nov 2011
    Posts
    116
    Rep Power
    0

    Default Re: How to return your IP address?

    Sockets don't open or close ports in general, they just connect to a port number specified by the user. The socket connection can then determine if the port is opened or not. And no, ports do not close when closing a socket. Thanks

  4. #24
    Tolls is offline Moderator
    Join Date
    Apr 2009
    Posts
    12,006
    Rep Power
    20

    Default Re: How to return your IP address?

    A listening socket requests a port, which the OS supplies (assuming it's not in use).
    When it closes I thought it handed that port back to the OS, which would close it at some point.

    Happy to be corrected, since it's been a couple of decades(+) since I had to do this stuff in any significant way.
    Please do not ask for code as refusal often offends.

    ** This space for rent **

Page 2 of 2 FirstFirst 12

Similar Threads

  1. Getting IP address
    By GaneshB in forum Networking
    Replies: 11
    Last Post: 01-26-2012, 10:26 AM
  2. set IP address
    By yolimau in forum Networking
    Replies: 10
    Last Post: 05-30-2010, 02:37 AM
  3. Client IP Address
    By goodjonx in forum Networking
    Replies: 3
    Last Post: 09-23-2009, 10:27 AM
  4. JSP getting IP address
    By Java Tip in forum Java Tip
    Replies: 0
    Last Post: 01-29-2008, 09:05 AM
  5. MAC address capturing
    By viswa.tk in forum Java Applets
    Replies: 0
    Last Post: 12-13-2007, 08:36 AM

Posting Permissions

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