Wsd port как узнать ip
Thanks for your replay.
But I cannot understand how to write C++ code.
I know printer name.
I can get the port name from PORT_INFO.
Then how to get the IP Address from printer name or port name?
If you know the site of sample code, please tell me the URL.
for a newbie like me what you said sound like a solution however , what I don’t understand is, which tool gives you this " PKEY_PNPX_IpAddress."
also you mentioned WSD API. do you have any example on this subject?
thanks in advance.
The Windows SDK include a header file named FunctionDiscoveryKeys.h that defines PKEY_PNPX_IpAddress. Its definition looks like this:
DEFINE_PROPERTYKEY(PKEY_PNPX_IpAddress, 0x656A3BB3, 0xECC0, 0x43FD, 0x84, 0x77, 0x4A, 0xE0, 0x40, 0x4A, 0x96, 0xCD, 0x00003009); // VT_LPWSTR | VT_VECTOR
You can use it from C code. Or, in Windows 10, you can query it from powershell:
Get-PnpDeviceProperty -KeyName ‘ <656A3BB3-ECC0-43FD-8477-4AE0404A96CD>12297′ -InstanceId ‘UMB\http://schemas.microsoft.com/windows/2006/08/wdp/print/PrinterServiceType\some_instance_path’
The InstanceId uniquely identifies the device on the system. Get-PnpDevice lists all the devices, and you can find the one you’re interested in. So you could write a bit of powershell to print a table of all the WSD devices and their IP addresses. I don’t actually have any WSD devices handy right now, so I can’t give you finished code, but here’s a starting point that might give you an idea:
Способы определения IP-адреса сетевого принтера в Windows 10?
Независимо от того, один ли у вас принтер, подключенный к домашней сети, или целый ряд устройств печати, расположенных в офисе, есть много веских причин узнать их IP-адреса. Наличие у него статического IP-адреса облегчает обмен данными с другими устройствами в сети. В случае, если компьютер перестает обнаруживать сетевой принтер, то по IP-адресу можно его быстро найти.

Как найти принтер с помощью панели управления?
Часто бывает так, что лучшие решения в Windows 10 находятся не в новых настройках и интерфейсах, к которым нас пытается перенаправить ОС, а в классических инструментах, буквально отодвинутых на задний план. К таким инструментам относится Панель управления.
Наберите в строке поиска Windows «Панель управления» и при отображении результата щелкните по нему.

Переключите просмотр на крупные или мелкие значки и найдите в списке раздел «Устройства и принтеры».

Выберите подключенный по сети, щелкните по нему правой кнопкой мыши и перейдите в Свойства.

На вкладке «Веб-службы» узнаете IP-адрес, указанный в нижней части окна.

Поиск по IP в свойствах принтера
Несмотря на то, включен ли принтер или нет, можно достаточно легко найти его IP-адрес (или WSD-адрес) в Windows 10.
Наберите в поисковой строке «принтеры и сканеры » и щелкните по найденному результату.

В списке выберите устройство, IP-адрес которого хотите узнать, затем перейдите на вкладку Управление — Свойства принтера — Порты.

Прокрутите список вниз пока не найдете порт, на котором находится принтер.
Возможно, устройство использует не «Стандартный порт TCP/IP», а WSD. Это протокол предназначен для подключения беспроводных устройств в сети, эффективно обрабатывая их как USB-устройства или plug-and-play. В этом случае WSD и IP-порт выполняют одну и ту же роль.
Независимо от того, подключен он по IP или WSD, все равно сможете добавить его вручную на других компьютерах Windows 10. Просто удостоверьтесь, что выбрали пункт «Добавить принтер с использованием TCP/IP-адреса или имени узла», затем укажите правильный тип (TCP/IP или веб-службу) из выпадающего меню.
Отображения IP на странице пробной печати
Почти на каждом принтере можно напечатать пробную страницу, отображающую все диагностическую информацию, включая уровень чернил. В большинстве случаев кнопка, выводящая на печать эти данные, обозначена букой «i».
Если устройство печати оснащено дисплеем, возможно, не придется печатать пробную страницу. Просто на экране перейдите к параметрам сети и поищите варианты в разделах Сетевой адрес, « TCP/IP» или Состояние Wi-Fi.
Поиск IP в настройках роутера
Поскольку сетевые принтеры подключаются к роутеру, вполне возможно, что он содержит данные об IP-адресах.
Где именно находятся эти данные, зависит от модели роутера. Обычно их можно найти в разделах сетевых или подключаемых устройств. Просмотрите все меню роутера, в результате вы должны на него наткнуться.
Wsd port как узнать ip
Thanks for your replay.
But I cannot understand how to write C++ code.
I know printer name.
I can get the port name from PORT_INFO.
Then how to get the IP Address from printer name or port name?
If you know the site of sample code, please tell me the URL.
for a newbie like me what you said sound like a solution however , what I don’t understand is, which tool gives you this » PKEY_PNPX_IpAddress.»
also you mentioned WSD API. do you have any example on this subject?
thanks in advance.
The Windows SDK include a header file named FunctionDiscoveryKeys.h that defines PKEY_PNPX_IpAddress. Its definition looks like this:
DEFINE_PROPERTYKEY(PKEY_PNPX_IpAddress, 0x656A3BB3, 0xECC0, 0x43FD, 0x84, 0x77, 0x4A, 0xE0, 0x40, 0x4A, 0x96, 0xCD, 0x00003009); // VT_LPWSTR | VT_VECTOR
You can use it from C code. Or, in Windows 10, you can query it from powershell:
Get-PnpDeviceProperty -KeyName ‘ 12297′ -InstanceId ‘UMB\http://schemas.microsoft.com/windows/2006/08/wdp/print/PrinterServiceType\some_instance_path’
The InstanceId uniquely identifies the device on the system. Get-PnpDevice lists all the devices, and you can find the one you’re interested in. So you could write a bit of powershell to print a table of all the WSD devices and their IP addresses. I don’t actually have any WSD devices handy right now, so I can’t give you finished code, but here’s a starting point that might give you an idea:
How to Find a Printer's IP Address
4 easy ways to quickly find your printer's IP address
- University of Maine
- Tweet
- Share
- Tweet
- Share
- ISP
- The Wireless Connection
- Routers & Firewalls
- Network Hubs
- Broadband
- Ethernet
- Installing & Upgrading
- Wi-Fi & Wireless
What to Know
- Easiest method: In the printer menu, look for View Wireless Details.
- Next easiest: In Windows, access Printer Properties and go to Web Services or Ports.
- To use the command prompt: Enter netstat -r and press Enter.
This article explains how to find the IP address of a network-enabled printer on your network in four ways: in the printer’s menu, the printer settings on your computer, by issuing a command, or on your router.
Find the Printer IP Address Using the Printer's Built-In Menu
On most printers, the network setting is found in the printer menu under Preferences, Options, or Wireless Settings (if it's a wireless printer).
The IP address for the printer may be displayed at the top of the network settings dialog box. If you don't see it, click through the submenus, such as View Wireless Details, to find the IP address.
In most cases, you can't manually set this IP address. Your wireless router assigns IP addresses automatically to devices that connect to your home network.
Check the printer settings on your computer
If you don't have access to the printer or if you don't want to search through the menu system, find the printer IP address on any computer on which the printer is set up.
For Windows
Open Control Panel > Devices and Printers. Right-click the printer and select Properties.
One of two sets of tabs displays, depending on the type of connection the printer driver uses. If the printer is set up under a WSD port, it uses Web Services for Devices technology to connect to the printer. In this case, select the Web Services tab to see the printer IP address listed in the IP address field.
If you don’t see a Web Services tab, then the printer is set up using a TCP/IP port. In this case, find the IP address in Printer Properties.
In Control Panel, choose Devices and Printers.
Right-click the printer and select Properties.
Select the Ports tab. The IP address is displayed in the Port field.
If you don't see the IP address, select Configure Port to see the IP address configured for that printer.
This method to find a printer IP address works for all versions of Windows, but the steps to get to the Control Panel can vary slightly.
In macOS, printer IP addresses may not be visible for Airprint printers. Use one of the other methods here to find the IP address for the printer instead.
Find the IP Address by Issuing a Command
Another quick trick to find the printer IP address is with the command prompt.
For Windows
Go to the Start menu and enter cmd.
In the Best match section, choose Command Prompt.
Enter netstat -r and press Enter. If the printer is connected using TCP/IP (not WSD), the printer displays in the list of Active Routes in the IPv4 Route Table.
For macOS
Open Safari (or your browser of choice) and enter localhost:631/printers to see a list of printers and associated IP addresses. These addresses appear in the Location column if the printers are available.
When using an AirPrint printer, the IP may not show up using the method above. In this case, open Applications > Utilities > Terminal and enter ippfind. You'll see something like ipp://yourprinter.local.:631/ipp/port1, where yourprinter is an alphanumeric expression — in this example, 829B95000000.local.
Enter ping yourprinter.local (where yourprinter is the alphanumeric expression returned by the previous step). The result displays the printer IP address.
Find a Printer's IP Address Using the Router
The last option is to go directly to your router. The router manages all network traffic, so the printer IP must be registered there as a connected device. To view the IP, log in to the router. You’ll need the administrator ID and password for the router. If you don’t know it, ask whoever set up the router for you.
First, you'll need to know the default gateway IP address. Regardless of the type of computer you use on the network, this is typically http://10.1.1.1 or http://192.168.1.1. If neither of these work, look yours up.
For Windows
Click Start and enter cmd.
Under Best match, select Command Prompt.
Enter ipconfig. Note the default gateway IP address.
In MacOS, open System Preferences > Network > Advanced > TCP/IP. You'll see the default gateway address next to Router.
The steps are the same regardless of the operating system but can vary slightly depending on the router manufacturer. Open a web browser, and type the default gateway IP address (from the previous step) into the address bar.
In the router login screen, log in to the router using the administrator ID and password.
In the router menu system, select Connected Devices.
In the Host Name field, select the printer.
The printer IP address is listed under IPV4 Address.
What You Can Do With Your Printer's IP Address
Once you have the IP address of your printer, use it to set up the printer from any computer or mobile device connected to your network.
Having the printer IP address handy also enables you to type a ping command in the command prompt from any computer if you have printer problems and need to check if the printer is on the network.