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?
-
which OS? which language are you using? – Brian R. Bondy Apr 05 '09 at 17:46
-
The rules on Windows and Unix/Linux are different - it is always crucial to know which. – Jonathan Leffler Apr 05 '09 at 17:50
-
@Taylor Sullivan: ya Windows and Linux named pipes are a bit different. I gave the info for windows below. – Brian R. Bondy Apr 05 '09 at 18:15
3 Answers
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.

- 339,232
- 124
- 596
- 636
-
You should not use WNetUseConnection. HANDLE htoken = NULL; LogonUser(L"username", L"domain", L"password", 9, 3, &htoken); int ret = ImpersonateLoggedOnUser(htoken); – Bluebaron Sep 30 '11 at 13:44
-
1Could someone explain how it works on linux using WLAN as the physical connection layer? – fer y Nov 29 '13 at 07:58
Be aware, pipes under Windows are bloody awful. There's a lot of crucial detail you need to get exactly right, or they fail strangely and the documentation isn't up to scratch.
If you can, use sockets.