Solved

A question about getAddress()

Posted on 1998-07-14
3
177 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

Networking for the Cloud Era

Join Microsoft and Riverbed for a discussion and demonstration of enhancements to SteelConnect:
-One-click orchestration and cloud connectivity in Azure environments
-Tight integration of SD-WAN and WAN optimization capabilities
-Scalability and resiliency equal to a data center

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
windows explorer path to command prompt 5 54
Opening PDF on button click and fill new document 2 47
mysql jsp example issue 32 53
Java program running SQL query 5 38
Java had always been an easily readable and understandable language.  Some relatively recent changes in the language seem to be changing this pretty fast, and anyone that had not seen any Java code for the last 5 years will possibly have issues unde…
In this post we will learn how to connect and configure Android Device (Smartphone etc.) with Android Studio. After that we will run a simple Hello World Program.
Viewers learn about the scanner class in this video and are introduced to receiving user input for their programs. Additionally, objects, conditional statements, and loops are used to help reinforce the concepts. Introduce Scanner class: Importing…
This video teaches viewers about errors in exception handling.

820 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