Win32 named pipes and remote clients

13,684

Solution 1

Yes you can communicate across the network via named pipes. You specify the pipe name like a UNC path:

\\computername\pipe\pipename

or via IP

\\192.168.0.100\pipe\pipename

You can do this for any LAN machine, or for any remote machine connected to your LAN via VPN.

You use all of the same pipe Win32 API functions such as CreateFile. To create the pipe you use CreateNamedPipe.

Before you can use a remote pipe, you must have a valid connection to the remote computer. To do this you would use an API like WNetUseConnection. Or if your computer is on the same domain, or has the same u/p you don't need to use WNetUseConnection at all.

If you are running your program as a service, you cannot access LAN resources with the local system account. The service would have to be configured with another account.

Solution 2

Named pipes can be used to provide IPC between processes on different computers across a network. Refer MSDN.

If you are having Windows XP SP2, Windows Server 2003 SP1 and later versions, then don't forget to enable the named pipe filtering. Refer here.

Share:
13,684
Admin
Author by

Admin

Updated on June 04, 2022

Comments

  • Admin
    Admin almost 2 years

    Can I access a named pipe on computer A from computer B given computer A's IP address? If so, what do I need to do to make this happen?

  • Bluebaron
    Bluebaron over 12 years
    You should not use WNetUseConnection. HANDLE htoken = NULL; LogonUser(L"username", L"domain", L"password", 9, 3, &htoken); int ret = ImpersonateLoggedOnUser(htoken);
  • fer y
    fer y over 10 years
    Could someone explain how it works on linux using WLAN as the physical connection layer?