c++ - Named Pipe server can't get the pipe handle state -
i'm working on application acts server named pipe. application solely designed send data out client (not written me), needs informed of when pipe broken. idea task use getnamedpipehandlestate()
retrieve number of instances of pipe , see if pipe still resident in system. if no longer connected, program designed reset pipe client can reconnect , resume pulling data application. unfortunately, can't retrieve number of instances of pipe. whenever call made, function fails getlasterror()
returning error_access_denied
. however, occurs if attempt call follows:
getnamedpipehandlestatea(pipe,0,&npipeinstances,0,0,0,0);
if call function this:
getnamedpipehandlestatea(pipe,0,0,0,0,0,0);
no errors occur, don't receive state information. there creation parameter missing, or better way check information?
the creation code pipe follows:
pipe=createnamedpipea(pipename, // name of pipe pipe_access_outbound, // read/write access pipe_type_message | // message type pipe pipe_wait, // blocking mode 1, // max. instances 65535, // output buffer size 65535, // input buffer size 300, // client time-out null); // default security attribute
from api docs:
hnamedpipe [in] handle named pipe information wanted. handle must have generic_read access read-only or read/write pipe, or must have generic_write , file_read_attributes access write-only pipe.
if have opened pipe handle (pipe
) pipe_access_outbound
, don't think satisfy condition. hence error_access_denied
error.
Comments
Post a Comment