Results 21 to 24 of 24
Thread: How to return your IP address?
- 03-01-2012, 03:37 PM #21
Senior Member
- Join Date
- Nov 2011
- Posts
- 116
- Rep Power
- 0
Re: How to return your IP address?
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.
- 03-01-2012, 04:05 PM #22
Moderator
- Join Date
- Apr 2009
- Posts
- 10,481
- Rep Power
- 16
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.
- 03-01-2012, 04:12 PM #23
Senior Member
- Join Date
- Nov 2011
- Posts
- 116
- Rep Power
- 0
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
- 03-01-2012, 05:18 PM #24
Moderator
- Join Date
- Apr 2009
- Posts
- 10,481
- Rep Power
- 16
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.
Similar Threads
-
Getting IP address
By GaneshB in forum NetworkingReplies: 11Last Post: 01-26-2012, 10:26 AM -
set IP address
By yolimau in forum NetworkingReplies: 10Last Post: 05-30-2010, 02:37 AM -
Client IP Address
By goodjonx in forum NetworkingReplies: 3Last Post: 09-23-2009, 10:27 AM -
JSP – getting IP address
By Java Tip in forum Java TipReplies: 0Last Post: 01-29-2008, 09:05 AM -
MAC address capturing
By viswa.tk in forum Java AppletsReplies: 0Last Post: 12-13-2007, 08:36 AM


1Likes
LinkBack URL
About LinkBacks
Reply With Quote
Bookmarks