c# - How to Let Two Processes Running on Different Hosts Communicate via Named Pipe -
i'm using named pipes let 2 processes running on different hosts communicate. here server code:
public class pipeserver { public static void main() { pipesecurity ps = new pipesecurity(); ps.addaccessrule(new pipeaccessrule("everyone", pipeaccessrights.fullcontrol, system.security.accesscontrol.accesscontroltype.allow)); namedpipeserverstream pipeserver = new namedpipeserverstream( "testpipe", pipedirection.inout, 4, pipetransmissionmode.message, pipeoptions.writethrough, 1024, 1024, ps); streamreader sr = new streamreader(pipeserver); streamwriter sw = new streamwriter(pipeserver); { try { pipeserver.waitforconnection(); sw.writeline("waiting"); sw.flush(); pipeserver.waitforpipedrain(); string message = sr.readline(); sw.writeline("got message " + message); } catch (exception ex) { throw ex; } { pipeserver.waitforpipedrain(); if (pipeserver.isconnected) { pipeserver.disconnect(); } } } while (true); } }
... , here client code:
public class pipeclient { static void main(string[] args) { namedpipeclientstream pipeclient = new namedpipeclientstream( "10.225.154.59", "testpipe", pipedirection.inout, pipeoptions.none, tokenimpersonationlevel.none); if (pipeclient.isconnected != true) { pipeclient.connect(); } streamreader sr = new streamreader(pipeclient); streamwriter sw = new streamwriter(pipeclient); string temp; temp = sr.readline(); if (temp == "waiting") { try { sw.writeline("hello"); sw.flush(); pipeclient.close(); } catch (exception ex) { throw ex; } } } }
after start pipeserver
on remote host, run client on workstation... following error message:
unhandled exception: system.io.ioexception: logon failure: unknown user name or bad password. @ system.io.__error.winioerror(int32 errorcode, string maybefullpath) @ system.io.pipes.namedpipeclientstream.connect(int32 timeout) @ system.io.pipes.namedpipeclientstream.connect() pipeclient.program.main(string[] args) in g:\my projects\lab\namepipes\program.cs:line 18
the user runs pipeserver
on remote host different user runs pipeclient
on workstation... should not issue since i've added proper access rule.
am missing something?
edit additional info suggested alexei. user runs server local administrator, while user runs client domain user. there way let send message server?
Comments
Post a Comment