Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

A question about getAddress()

Posted on 1998-07-14
3
Medium Priority
?
180 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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 100 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

Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Java contains several comparison operators (e.g., <, <=, >, >=, ==, !=) that allow you to compare primitive values. However, these operators cannot be used to compare the contents of objects. Interface Comparable is used to allow objects of a cl…
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 tutorial covers a practical example of lazy loading technique and early loading technique in a Singleton Design Pattern.
Suggested Courses

670 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