In IPC code if i get a handle from a named pipe by using the Win32 API by calling CreateFile
everything works. If i do the same thing using the NamedPipeClientStream
it does not want to connect.
Working Version
[DllImport("kernel32.dll")]
internal static extern SafePipeHandle CreateFile(
string lpFileName,
uint dwDesiredAccess,
uint dwShareMode,
IntPtr securityAttributes,
uint dwCreationDisposition,
uint dwFlagsAndAttributes,
IntPtr hTemplateFile);
public openPipe()
{
SafePipeHandle localDeviceHandle;
// Second Paameter is READ/WRITE Access, Fifth Parameter Open Existing
// This was done for brevity of the example.
localDeviceHandle = FileApi.CreateFile("\\\\.\\SeaMAC0",
(uint)3,
0,
IntPtr.Zero,
(uint)3,
(uint)FileApi.FileAttribute.Normal,
IntPtr.Zero);
}
Non Working
public openPipe()
{
SeaLevelNamedPipe = new NamedPipeClientStream("SeaMAC0");
/*or SeaLevelNamedPipe = new NamedPipeClientStream(".","SeaMAC0");*/
SeaLevelNamedPipe.Connect(); //It will hang here for ever
}
The code here is far from complete and done for brevity. Shouldn't they function the same?
I do not have access to the server pipe code as this was developed by a third party.