473,804 Members | 3,497 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

How to retrieve IP address ???

Dear all,

I have a tool which is able to receive any kind of data
from a remote system.
For that I need to get the ipadress of the remote system.

If the system is not connected to a DHCP server no
problem , I set in my configuration the ip adress.

Then if my remote system is connected to a DHCP server,
how can I get retriev the given IP adress ?

thanks for your help
regards
serge

Jul 21 '05 #1
3 2324
Hi Serge,

Do you have the machine name or DNS name of the machine? If so you can use
System.Net.Dns. GetHostByName(" theName") to get the IP address(es) for the
machine.

Such as:
IPHostEntry hostInfo = Dns.GetHostByNa me("jimblizz01" );
Console.WriteLi ne("host name: " + hostInfo.HostNa me);
IPAddress[] address = hostInfo.Addres sList;
Console.WriteLi ne("\nIP address list : ");
for(int index=0; index < address.Length; index++)
{
Console.WriteLi ne(address[index]);
}

Console.ReadLin e();

Hope this helps,
- bliz

Jim Blizzard, MCSD .NET | http://www.snowstormlife.com/blog
Community Developer Evangelist | http://www.microsoft.com/communities

This posting is provided AS IS, without warranty and confers no rights.
"serge calderara" <se************ *@maillefer.net > wrote in message
news:0a******** *************** *****@phx.gbl.. .
Dear all,

I have a tool which is able to receive any kind of data
from a remote system.
For that I need to get the ipadress of the remote system.

If the system is not connected to a DHCP server no
problem , I set in my configuration the ip adress.

Then if my remote system is connected to a DHCP server,
how can I get retriev the given IP adress ?

thanks for your help
regards
serge

Jul 21 '05 #2
Thanks for your answer....
Yes the only thing I might know is the name of the PC.
But the way my customer will handle name resolution is not
under my control.

Can I used what you suggest?

regards
serge
-----Original Message-----
Hi Serge,

Do you have the machine name or DNS name of the machine? If so you can useSystem.Net.Dns .GetHostByName( "theName") to get the IP address(es) for themachine.

Such as:
IPHostEntry hostInfo = Dns.GetHostByNa me("jimblizz01" );
Console.WriteLi ne("host name: " + hostInfo.HostNa me);
IPAddress[] address = hostInfo.Addres sList;
Console.WriteLi ne("\nIP address list : ");
for(int index=0; index < address.Length; index++)
{
Console.WriteLi ne(address[index]);
}

Console.ReadLin e();

Hope this helps,
- bliz

Jim Blizzard, MCSD .NET | http://www.snowstormlife.com/blogCommunity Developer Evangelist | http://www.microsoft.com/communities
This posting is provided AS IS, without warranty and confers no rights.

"serge calderara" <se************ *@maillefer.net > wrote in messagenews:0a******* *************** ******@phx.gbl. ..
Dear all,

I have a tool which is able to receive any kind of data
from a remote system.
For that I need to get the ipadress of the remote system.
If the system is not connected to a DHCP server no
problem , I set in my configuration the ip adress.

Then if my remote system is connected to a DHCP server,
how can I get retriev the given IP adress ?

thanks for your help
regards
serge

.

Jul 21 '05 #3
I don't quite understand the situation when you say name resolution isn't
under your control....

If you have the machine name, you should be able to get the IP address.

Can you clarify?

Thanks!

--
Jim Blizzard, MCSD .NET
Community Developer Evangelist | www.microsoft.com/communities
--------------------------------------------------------------------
This reply is provided AS IS, without warranty (express or implied).
--------------------
Content-Class: urn:content-classes:message
From: "serge calderara" <se************ *@maillfer.net>
Sender: "serge calderara" <se************ *@maillfer.net>
References: <0a************ *************** *@phx.gbl> <3f********@new s.microsoft.com >Subject: Re: How to retrieve IP address ???
Date: Wed, 22 Oct 2003 23:42:53 -0700 Thanks for your answer....
Yes the only thing I might know is the name of the PC.
But the way my customer will handle name resolution is not
under my control.

Can I used what you suggest?

regards
serge
-----Original Message-----
Hi Serge,

Do you have the machine name or DNS name of the machine?

If so you can use
System.Net.Dn s.GetHostByName ("theName") to get the IP

address(es) for the
machine.

Such as:
IPHostEntry hostInfo = Dns.GetHostByNa me("jimblizz01" );
Console.WriteLi ne("host name: " + hostInfo.HostNa me);
IPAddress[] address = hostInfo.Addres sList;
Console.WriteLi ne("\nIP address list : ");
for(int index=0; index < address.Length; index++)
{
Console.WriteLi ne(address[index]);
}

Console.ReadLin e();

Hope this helps,
- bliz

Jim Blizzard, MCSD .NET |

http://www.snowstormlife.com/blog
Community Developer Evangelist |

http://www.microsoft.com/communities

This posting is provided AS IS, without warranty and

confers no rights.


"serge calderara" <se************ *@maillefer.net > wrote

in message
news:0a****** *************** *******@phx.gbl ...
Dear all,

I have a tool which is able to receive any kind of data
from a remote system.
For that I need to get the ipadress of the remotesystem.
If the system is not connected to a DHCP server no
problem , I set in my configuration the ip adress.

Then if my remote system is connected to a DHCP server,
how can I get retriev the given IP adress ?

thanks for your help
regards
serge

.


Jul 21 '05 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

5
16548
by: Gidraz | last post by:
Hello, i can't figure out how to retrieve clients MAC address using C#.NET. I can get IP but not MAC. Thanks in advance. Gidraz
6
5174
by: Daniele | last post by:
Hi all, We are developing a .net application that can accept xml documents. Every xml document can match a single schema, or it may be composed by multiple different elements and each of these can match a different xsd schema. Is there a way to retrieve the namespace collection of all the document namespaces for which there is at least one element in the document?
0
1276
by: rey17 | last post by:
hi i'm working on a project and my application will be running on pocket pc(i'm using .NET CF). basically my application should be able to retrieve my pocket's ipv6 address (it's the link-local address not the global address) and then multicast the address to other pocket pc around it; so, could anyone could told me show me/what should i do (with some simple code if possible) how does it works.. thanks in advance
3
466
by: serge calderara | last post by:
Dear all, I have a tool which is able to receive any kind of data from a remote system. For that I need to get the ipadress of the remote system. If the system is not connected to a DHCP server no problem , I set in my configuration the ip adress. Then if my remote system is connected to a DHCP server,
2
3338
by: Noro | last post by:
Hi All, When I try to get the email address of the current user, I retrieve a string like this that represents the email address: /o=ORGANIZATION/ou=Sede/cn=Recipients/cn=USERNAME What can I do to retrieve the smtp address from this exchange address? Thank you!
4
2090
by: kang jia | last post by:
hi i am doing mailinglist currently. the code in my first page is like this : : <html> <head> <link rel="stylesheet" type="text/css" href="gallery.css" /> <script language="JavaScript"> <!--
1
1611
by: =?Utf-8?B?UmljaA==?= | last post by:
Greetings, I am using a web browser control to browse windows explorer. I give it a default address as below and then click on some folder. The question is: how do I retrieve the address of the folder I clicked on so that I can display it in a textbox similar to windows explorer? object loc = "W:\\EP 2005"; object null_obj_str = ""; System.Object null_obj = 0;
3
3047
by: Keith Thompson | last post by:
Victor <vhnguyenn@yahoo.comwrites: You're declaring an array of pointers to unsigned long long, but you're initializing the pointers with integer values. This is actually a constraint violation, and your compiler should have warned you about it. Your problem is either that you're invoking your compiler in some non-standard mode that inhibits the warnings, or getting warnings and not bothering to tell us about them.
12
78030
lifeisgreat20009
by: lifeisgreat20009 | last post by:
I am a newbie to Struts and JSP...I have been working on the code below for 5 hours now..I googled a lot but couldn't get much help so finally I am here.. Hoping of getting my problem solved. Please give me some idea where I am going wrong ?? I just want to retrieve data from my emp_mstr table and display it using my JSP file... The table emp_mstr is as follows :- CREATE TABLE EMP_MSTR( EMP_NO VARCHAR(10) PRIMARY KEY, PASSWORD...
0
9704
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9571
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10561
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10069
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
9132
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
5505
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5639
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4277
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
3
2976
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.