Solved

A question about getAddress()

Posted on 1998-07-14
3
175 Views
Last Modified: 2010-03-30
These sentences in Visual J++ 1.0 help:
"InetAddress getAddress()

Returns:
the IP address (§4.4) of the machine to which this datagram is being sent, or from which the datagram was received."

what does it mean the destination IP or the source IP?
Thanks.
0
Comment
Question by:tungsim
  • 2
3 Comments
 
LVL 5

Expert Comment

by:msmolyak
ID: 1226327
The InetAddress object represents an IP address. Whose address it is depends on how you obtained that object.

Example
// This is the address of the machine where the program is running
InetAddress addr = InteAddress.getLocalHost();
byte[] byteAddr = addr.inetAddress();
0
 
LVL 1

Accepted Solution

by:
dryang earned 50 total points
ID: 1226328
getAddress() is to obtain the address of the local machine
getInetAddress() is to get the address of the remote machine
0
 
LVL 1

Expert Comment

by:dryang
ID: 1226329
oops forgot the second part
source IP is the address where a request originates
destination IP is he address where the request gets sent to.
The source IP does not need to be the local machine, nor the destination IP a remote machine. It can be the other way round
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Java Filesystem manipulation of Word Docx file (find replace text) 3 63
recursion example 16 111
JUnit 4 @Before and @BeforeClass differences 3 47
table example 4 19
After being asked a question last year, I went into one of my moods where I did some research and code just for the fun and learning of it all.  Subsequently, from this journey, I put together this article on "Range Searching Using Visual Basic.NET …
By the end of 1980s, object oriented programming using languages like C++, Simula69 and ObjectPascal gained momentum. It looked like programmers finally found the perfect language. C++ successfully combined the object oriented principles of Simula w…
Viewers will learn one way to get user input in Java. Introduce the Scanner object: Declare the variable that stores the user input: An example prompting the user for input: Methods you need to invoke in order to properly get  user input:
Viewers will learn about if statements in Java and their use The if statement: The condition required to create an if statement: Variations of if statements: An example using if statements:

932 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

11 Experts available now in Live!

Get 1:1 Help Now