473,320 Members | 1,694 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,320 software developers and data experts.

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 2264
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.GetHostByName("jimblizz01");
Console.WriteLine("host name: " + hostInfo.HostName);
IPAddress[] address = hostInfo.AddressList;
Console.WriteLine("\nIP address list : ");
for(int index=0; index < address.Length; index++)
{
Console.WriteLine(address[index]);
}

Console.ReadLine();

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.GetHostByName("jimblizz01");
Console.WriteLine("host name: " + hostInfo.HostName);
IPAddress[] address = hostInfo.AddressList;
Console.WriteLine("\nIP address list : ");
for(int index=0; index < address.Length; index++)
{
Console.WriteLine(address[index]);
}

Console.ReadLine();

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********@news.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.Dns.GetHostByName("theName") to get the IP

address(es) for the
machine.

Such as:
IPHostEntry hostInfo = Dns.GetHostByName("jimblizz01");
Console.WriteLine("host name: " + hostInfo.HostName);
IPAddress[] address = hostInfo.AddressList;
Console.WriteLine("\nIP address list : ");
for(int index=0; index < address.Length; index++)
{
Console.WriteLine(address[index]);
}

Console.ReadLine();

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
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
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...
0
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...
3
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...
2
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...
4
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
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...
3
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...
12
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...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...

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.