Solved

A question about getAddress()

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

Problems using Powershell and Active Directory?

Managing Active Directory does not always have to be complicated.  If you are spending more time trying instead of doing, then it's time to look at something else. For nearly 20 years, AD admins around the world have used one tool for day-to-day AD management: Hyena. Discover why

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
groupSumClump challenge 9 115
advertisement module in core php 4 162
Java Jpanels and Jframe 8 33
Why my table column Id is not passed to java object? 4 39
INTRODUCTION Working with files is a moderately common task in Java.  For most projects hard coding the file names, using parameters in configuration files, or using command-line arguments is sufficient.   However, when your application has vi…
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 learn how to read error messages and identify possible mistakes that could cause hours of frustration. Coding is as much about debugging your code as it is about writing it. Define Error Message: Line Numbers: Type of Error: Break Down…
This theoretical tutorial explains exceptions, reasons for exceptions, different categories of exception and exception hierarchy.

773 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