How to get the ip address of a printer?

Hi all,
I have a network printer, how can I get the Printer Ip address from The Printer name? is there any classes or functions to do this?
Thanks.
[158 byte] By [Handi] at [2008-2-10]
# 1

Hi,

You can get the IPAddress by using the machine name of the Printer.


IPHostEntry hostInfo = Dns.GetHostByName("MachineName");
string strIPAdress = hostInfo.Addre­ssList[0].ToString();

Regards,
Vikram

Vikram at 2007-9-9 > top of Msdn Tech,.NET Development,.NET Framework Networking and Communication...
# 2
hi Vikram,
Thanks for you reply,

but how to get the machine name or a printer? I just know the Printer Name .

Thanks again.

Handi at 2007-9-9 > top of Msdn Tech,.NET Development,.NET Framework Networking and Communication...
# 3
I think it's the same as the computer's name, is it not?
Jeremy_B at 2007-9-9 > top of Msdn Tech,.NET Development,.NET Framework Networking and Communication...
# 4
Hi,

In case of a network printer it may not be so. When I see in my Printer Properties I see it as : Printer01 on Server01 and I can access the printer as
\\Server01\Printer01 and the Server also has other Printers.

So, I guess you need to explicitly know the Server to which the Printer is attached.

Regards,
Vikram

Vikram at 2007-9-9 > top of Msdn Tech,.NET Development,.NET Framework Networking and Communication...
# 5
Hi, thanks for your reply, but the question is get the Printer's IP address, not the ip address of the host which printer installed on.

I install a network printer, which port is "ne4" and the port is TCP/IP standard Port, whose ip address is 192.168.0.2, My question is how to get the Ipaddress(192.168.0.2) of the Port?

Thanks all. :)

Handi at 2007-9-9 > top of Msdn Tech,.NET Development,.NET Framework Networking and Communication...

.NET Development

Site Classified