如何从IP在C#中访问打印机名称上网络? [英] How to access a printer name from IP on network in C#?

查看:1744
本文介绍了如何从IP在C#中访问打印机名称上网络?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我可以得到一个名为\\xxxx\ [打印机名称]打印机,但不知道如何与打印机的唯一的IP访问此。 ?任何想法

I can get to the printer with the name "\\xxxx\[name of printer]" but have no idea how to access this with only the IP of the printer. Any ideas?

编辑:答案似乎表明,我可以简单地换出打印机名称为打印机的IP地址,但是这似乎并没有成为案件。任何更多的想法。

The answers seem to suggest that I can simply swap out the printer name for the IP address of the printer, however this does not seem to be the case. Any MORE ideas?

更新:解决打印机作为IP是网络你们给了所有打印机相同的共享名,所以我没有办法的原因来区分他们,比他们的知识产权等。

UPDATE: the reason for addressing the printer as an IP is that the networking guys gave all of the printers the same share name, so I have no way to distinguish them, other than their IP.

推荐答案

完全相同的方式。

\\1.2.3.4\somesharedprinter

其中1.2.3.4是无论是共享打印机的IP地址

Where "1.2.3.4" is the IP address of whatever is sharing the printer.

编辑:

即使您的打印机具有内置网络接口,让我们精神上的片刻打印服务器的打印机中分离出来。

Even if your printer has a built-in network interface, let's mentally separate the printer from the print server for a moment.

当你有一台电脑,让我们称之为鲍勃,你共享一台打印机,让我们叫它printy,你可以这样访问:

When you have a computer, let's call it Bob, and you share a printer, let's call it printy, you can access it like this:

\\\ \\Bob\printy

此地址的第一部分是主机名或IP地址。如果Bob的IP地址是1.2.3.4,你可以很容易地使用这个地址来代替:

The first part of this address is the hostname or IP address. If Bob's IP address was 1.2.3.4, you could easily use this address instead:

\\1.2.3.4\printy

现在这听起来像您的打印机有一个内置打印服务器,这使得它能够通过网络本质上共享本身。大多数这些打印服务器与Windows文件/打印机共享完全兼容。因此,如果打印机的IP是2.3.4.5,我们可以用这样一个地址:

Now it sounds like your printer has a built-in print server which allows it to essentially share itself over the network. Most of these print servers are completely compatible with Windows File/Printer Sharing. So if the printer's IP is 2.3.4.5, we could use an address like this:

\\2.3.4.5\something

您想要的的东西部分,是吗?要做到这一点,我们需要枚举打印服务器上的共享。你可以做到这一点与这里找到的代码: http://www.codeproject.com/KB/IP/networkshares。 ASPX

You want the something part, yes? To do this we need to enumerate the shares on that print server. You can do that with the code found here: http://www.codeproject.com/KB/IP/networkshares.aspx

据我所知,有没有管理的方式来获得在服务器上共享列表,所以上面的链接可能是你目前最好的选择

To my knowledge, there is no managed way to get a list of shares on a server, so the link above is probably your best option for now.

我也应该注意,打印服务器另一种常见的标准是HP Jet直接。你不能(当然你可以,但它的hackish),直到你在系统上安装打印机打印到这些。要做到这一点,你会去打印机,添加打印机,选择本地(是的,有悖常理)打印机,端口选择TCP / IP,然后输入IP地址。

I should also note that another common standard for print servers is the HP Jet Direct. You can't (well you can, but it's hackish) print to these until you install the printer on your system. To do this, you would go to Printers, Add Printer, choose a "local" (yes, counterintuitive) printer, then for port choose TCP/IP, and then enter the IP address.

这篇关于如何从IP在C#中访问打印机名称上网络?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆