IGLib  1.5
The IGLib base library EXTENDED - with other lilbraries and applications.
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Events Macros
PipeNative Class Reference

The class exposes kernel32.dll methods for named pipes communication. More...

Public Member Functions

static uint GetLastError ()
 Retrieves the calling thread's last-error code value. More...
 
static IntPtr CreateNamedPipe (String lpName, PipeOpenMode dwOpenMode, PipeMode dwPipeMode, uint nMaxInstances, uint nOutBufferSize, uint nInBufferSize, uint nDefaultTimeOut, IntPtr pipeSecurityAttributes)
 Creates an instance of a named pipe and returns a handle for subsequent pipe operations. More...
 
static bool ConnectNamedPipe (IntPtr hHandle, IntPtr lpOverlapped)
 Enables a named pipe server process to wait for a client process to connect to an instance of a named pipe. More...
 
static bool WaitNamedPipe (String name, int timeout)
 Waits until either a time-out interval elapses or an instance of the specified named pipe is available for connection. More...
 
static bool SetNamedPipeHandleState (IntPtr hHandle, ref PipeMode lpMode, IntPtr lpMaxCollectionCount, IntPtr lpCollectDataTimeout)
 Sets the read mode and the blocking mode of the specified named pipe. More...
 
static IntPtr CreateFile (String lpFileName, FileDesiredAccess dwDesiredAccess, FileShareMode dwShareMode, IntPtr fileSecurityAttributes, FileCreationDisposition dwCreationDisposition, uint dwFlagsAndAttributes, uint hTemplateFile)
 Creates or opens a file, directory, physical disk, volume, console buffer, tape drive, communications resource, mailslot, or named pipe. More...
 
static bool ReadFile (IntPtr hHandle, byte[] lpBuffer, uint nNumberOfBytesToRead, out uint lpNumberOfBytesRead, IntPtr lpOverlapped)
 Reads data from a file, starting at the position indicated by the file pointer. More...
 
static bool WriteFile (IntPtr hHandle, byte[] lpBuffer, uint nNumberOfBytesToWrite, out uint lpNumberOfBytesWritten, IntPtr lpOverlapped)
 Writes data to a file at the position specified by the file pointer. More...
 
static bool CloseHandle (IntPtr hHandle)
 Closes an open object handle. More...
 
static bool FlushFileBuffers (IntPtr hHandle)
 Flushes the buffers of the specified file and causes all buffered data to be written to the file. More...
 
static bool DisconnectNamedPipe (IntPtr hHandle)
 Disconnects the server end of a named pipe instance from a client process. More...
 
static uint GetLastError ()
 Retrieves the calling thread's last-error code value. More...
 
static IntPtr CreateNamedPipe (String lpName, PipeOpenMode dwOpenMode, PipeMode dwPipeMode, uint nMaxInstances, uint nOutBufferSize, uint nInBufferSize, uint nDefaultTimeOut, IntPtr pipeSecurityAttributes)
 Creates an instance of a named pipe and returns a handle for subsequent pipe operations. More...
 
static bool ConnectNamedPipe (IntPtr hHandle, IntPtr lpOverlapped)
 Enables a named pipe server process to wait for a client process to connect to an instance of a named pipe. More...
 
static bool WaitNamedPipe (String name, int timeout)
 Waits until either a time-out interval elapses or an instance of the specified named pipe is available for connection. More...
 
static bool SetNamedPipeHandleState (IntPtr hHandle, ref PipeMode lpMode, IntPtr lpMaxCollectionCount, IntPtr lpCollectDataTimeout)
 Sets the read mode and the blocking mode of the specified named pipe. More...
 
static IntPtr CreateFile (String lpFileName, FileDesiredAccess dwDesiredAccess, FileShareMode dwShareMode, IntPtr fileSecurityAttributes, FileCreationDisposition dwCreationDisposition, uint dwFlagsAndAttributes, uint hTemplateFile)
 Creates or opens a file, directory, physical disk, volume, console buffer, tape drive, communications resource, mailslot, or named pipe. More...
 
static bool ReadFile (IntPtr hHandle, byte[] lpBuffer, uint nNumberOfBytesToRead, out uint lpNumberOfBytesRead, IntPtr lpOverlapped)
 Reads data from a file, starting at the position indicated by the file pointer. More...
 
static bool WriteFile (IntPtr hHandle, byte[] lpBuffer, uint nNumberOfBytesToWrite, out uint lpNumberOfBytesWritten, IntPtr lpOverlapped)
 Writes data to a file at the position specified by the file pointer. More...
 
static bool CloseHandle (IntPtr hHandle)
 Closes an open object handle. More...
 
static bool FlushFileBuffers (IntPtr hHandle)
 Flushes the buffers of the specified file and causes all buffered data to be written to the file. More...
 
static bool DisconnectNamedPipe (IntPtr hHandle)
 Disconnects the server end of a named pipe instance from a client process. More...
 
static uint GetLastError ()
 Retrieves the calling thread's last-error code value. More...
 
static IntPtr CreateNamedPipe (String lpName, PipeOpenMode dwOpenMode, PipeMode dwPipeMode, uint nMaxInstances, uint nOutBufferSize, uint nInBufferSize, uint nDefaultTimeOut, IntPtr pipeSecurityAttributes)
 Creates an instance of a named pipe and returns a handle for subsequent pipe operations. More...
 
static bool ConnectNamedPipe (IntPtr hHandle, IntPtr lpOverlapped)
 Enables a named pipe server process to wait for a client process to connect to an instance of a named pipe. More...
 
static bool WaitNamedPipe (String name, int timeout)
 Waits until either a time-out interval elapses or an instance of the specified named pipe is available for connection. More...
 
static bool SetNamedPipeHandleState (IntPtr hHandle, ref PipeMode lpMode, IntPtr lpMaxCollectionCount, IntPtr lpCollectDataTimeout)
 Sets the read mode and the blocking mode of the specified named pipe. More...
 
static IntPtr CreateFile (String lpFileName, FileDesiredAccess dwDesiredAccess, FileShareMode dwShareMode, IntPtr fileSecurityAttributes, FileCreationDisposition dwCreationDisposition, uint dwFlagsAndAttributes, uint hTemplateFile)
 Creates or opens a file, directory, physical disk, volume, console buffer, tape drive, communications resource, mailslot, or named pipe. More...
 
static bool ReadFile (IntPtr hHandle, byte[] lpBuffer, uint nNumberOfBytesToRead, out uint lpNumberOfBytesRead, IntPtr lpOverlapped)
 Reads data from a file, starting at the position indicated by the file pointer. More...
 
static bool WriteFile (IntPtr hHandle, byte[] lpBuffer, uint nNumberOfBytesToWrite, out uint lpNumberOfBytesWritten, IntPtr lpOverlapped)
 Writes data to a file at the position specified by the file pointer. More...
 
static bool CloseHandle (IntPtr hHandle)
 Closes an open object handle. More...
 
static bool FlushFileBuffers (IntPtr hHandle)
 Flushes the buffers of the specified file and causes all buffered data to be written to the file. More...
 
static bool DisconnectNamedPipe (IntPtr hHandle)
 Disconnects the server end of a named pipe instance from a client process. More...
 
static uint GetLastError ()
 Retrieves the calling thread's last-error code value. More...
 
static IntPtr CreateNamedPipe (String lpName, PipeOpenMode dwOpenMode, PipeMode dwPipeMode, uint nMaxInstances, uint nOutBufferSize, uint nInBufferSize, uint nDefaultTimeOut, IntPtr pipeSecurityAttributes)
 Creates an instance of a named pipe and returns a handle for subsequent pipe operations. More...
 
static bool ConnectNamedPipe (IntPtr hHandle, IntPtr lpOverlapped)
 Enables a named pipe server process to wait for a client process to connect to an instance of a named pipe. More...
 
static bool WaitNamedPipe (String name, int timeout)
 Waits until either a time-out interval elapses or an instance of the specified named pipe is available for connection. More...
 
static bool SetNamedPipeHandleState (IntPtr hHandle, ref PipeMode lpMode, IntPtr lpMaxCollectionCount, IntPtr lpCollectDataTimeout)
 Sets the read mode and the blocking mode of the specified named pipe. More...
 
static IntPtr CreateFile (String lpFileName, FileDesiredAccess dwDesiredAccess, FileShareMode dwShareMode, IntPtr fileSecurityAttributes, FileCreationDisposition dwCreationDisposition, uint dwFlagsAndAttributes, uint hTemplateFile)
 Creates or opens a file, directory, physical disk, volume, console buffer, tape drive, communications resource, mailslot, or named pipe. More...
 
static bool ReadFile (IntPtr hHandle, byte[] lpBuffer, uint nNumberOfBytesToRead, out uint lpNumberOfBytesRead, IntPtr lpOverlapped)
 Reads data from a file, starting at the position indicated by the file pointer. More...
 
static bool WriteFile (IntPtr hHandle, byte[] lpBuffer, uint nNumberOfBytesToWrite, out uint lpNumberOfBytesWritten, IntPtr lpOverlapped)
 Writes data to a file at the position specified by the file pointer. More...
 
static bool CloseHandle (IntPtr hHandle)
 Closes an open object handle. More...
 
static bool FlushFileBuffers (IntPtr hHandle)
 Flushes the buffers of the specified file and causes all buffered data to be written to the file. More...
 
static bool DisconnectNamedPipe (IntPtr hHandle)
 Disconnects the server end of a named pipe instance from a client process. More...
 
static uint GetLastError ()
 Retrieves the calling thread's last-error code value. More...
 
static IntPtr CreateNamedPipe (String lpName, PipeOpenMode dwOpenMode, PipeMode dwPipeMode, uint nMaxInstances, uint nOutBufferSize, uint nInBufferSize, uint nDefaultTimeOut, IntPtr pipeSecurityAttributes)
 Creates an instance of a named pipe and returns a handle for subsequent pipe operations. More...
 
static bool ConnectNamedPipe (IntPtr hHandle, IntPtr lpOverlapped)
 Enables a named pipe server process to wait for a client process to connect to an instance of a named pipe. More...
 
static bool WaitNamedPipe (String name, int timeout)
 Waits until either a time-out interval elapses or an instance of the specified named pipe is available for connection. More...
 
static bool SetNamedPipeHandleState (IntPtr hHandle, ref PipeMode lpMode, IntPtr lpMaxCollectionCount, IntPtr lpCollectDataTimeout)
 Sets the read mode and the blocking mode of the specified named pipe. More...
 
static IntPtr CreateFile (String lpFileName, FileDesiredAccess dwDesiredAccess, FileShareMode dwShareMode, IntPtr fileSecurityAttributes, FileCreationDisposition dwCreationDisposition, uint dwFlagsAndAttributes, uint hTemplateFile)
 Creates or opens a file, directory, physical disk, volume, console buffer, tape drive, communications resource, mailslot, or named pipe. More...
 
static bool ReadFile (IntPtr hHandle, byte[] lpBuffer, uint nNumberOfBytesToRead, out uint lpNumberOfBytesRead, IntPtr lpOverlapped)
 Reads data from a file, starting at the position indicated by the file pointer. More...
 
static bool WriteFile (IntPtr hHandle, byte[] lpBuffer, uint nNumberOfBytesToWrite, out uint lpNumberOfBytesWritten, IntPtr lpOverlapped)
 Writes data to a file at the position specified by the file pointer. More...
 
static bool CloseHandle (IntPtr hHandle)
 Closes an open object handle. More...
 
static bool FlushFileBuffers (IntPtr hHandle)
 Flushes the buffers of the specified file and causes all buffered data to be written to the file. More...
 
static bool DisconnectNamedPipe (IntPtr hHandle)
 Disconnects the server end of a named pipe instance from a client process. More...
 

Public Attributes

const uint PIPE_UNLIMITED_INSTANCES = 255
 Unlimited server pipe instances. More...
 
const ulong ERROR_SUCCESS = 0
 The operation completed successfully. More...
 
const ulong ERROR_CANNOT_CONNECT_TO_PIPE = 2
 The system cannot find the file specified. More...
 
const ulong ERROR_PIPE_BUSY = 231
 All pipe instances are busy. More...
 
const ulong ERROR_NO_DATA = 232
 The pipe is being closed. More...
 
const ulong ERROR_PIPE_NOT_CONNECTED = 233
 No process is on the other end of the pipe. More...
 
const ulong ERROR_MORE_DATA = 234
 More data is available. More...
 
const ulong ERROR_PIPE_CONNECTED = 535
 There is a process on other end of the pipe. More...
 
const ulong ERROR_PIPE_LISTENING = 536
 Waiting for a process to open the other end of the pipe. More...
 
const uint NMPWAIT_WAIT_FOREVER = 0xffffffff
 Waits indefinitely when connecting to a pipe. More...
 
const uint NMPWAIT_NOWAIT = 0x00000001
 Does not wait for the named pipe. More...
 
const uint NMPWAIT_USE_DEFAULT_WAIT = 0x00000000
 Uses the default time-out specified in a call to the CreateNamedPipe method. More...
 
const int INVALID_HANDLE_VALUE = -1
 Invalid operating system handle. More...
 

Detailed Description

The class exposes kernel32.dll methods for named pipes communication.

Member Function Documentation

static uint PipeNative.GetLastError ( )

Retrieves the calling thread's last-error code value.

Returns
The return value is the calling thread's last-error code value.

Referenced by Program.answerSNMP(), Program.listenToSNMP(), Program.PInvokeNativePipeClient(), and Program.PInvokeNativePipeServer().

static IntPtr PipeNative.CreateNamedPipe ( String  lpName,
PipeOpenMode  dwOpenMode,
PipeMode  dwPipeMode,
uint  nMaxInstances,
uint  nOutBufferSize,
uint  nInBufferSize,
uint  nDefaultTimeOut,
IntPtr  pipeSecurityAttributes 
)

Creates an instance of a named pipe and returns a handle for subsequent pipe operations.

Parameters
lpNamePipe name
dwOpenModePipe open mode
dwPipeModePipe-specific modes
nMaxInstancesMaximum number of instances
nOutBufferSizeOutput buffer size
nInBufferSizeInput buffer size
nDefaultTimeOutTime-out interval
pipeSecurityAttributesSecurity attributes
Returns
If the function succeeds, the return value is a handle to the server end of a named pipe instance.

Referenced by Program.answerSNMP(), Program.listenToSNMP(), and Program.PInvokeNativePipeServer().

static bool PipeNative.ConnectNamedPipe ( IntPtr  hHandle,
IntPtr  lpOverlapped 
)

Enables a named pipe server process to wait for a client process to connect to an instance of a named pipe.

Parameters
hHandleHandle to the server end of a named pipe instance.
lpOverlappedPointer to an Overlapped object.
Returns
If the function succeeds, the return value is nonzero.

Referenced by Program.answerSNMP(), Program.listenToSNMP(), and Program.PInvokeNativePipeServer().

static bool PipeNative.WaitNamedPipe ( String  name,
int  timeout 
)

Waits until either a time-out interval elapses or an instance of the specified named pipe is available for connection.

Parameters
namePointer to a null-terminated string that specifies the name of the named pipe.
timeoutNumber of milliseconds that the function will wait for an instance of the named pipe to be available.
Returns
If an instance of the pipe is available before the time-out interval elapses, the return value is nonzero.

Referenced by Program.PInvokeNativePipeClient().

static bool PipeNative.SetNamedPipeHandleState ( IntPtr  hHandle,
ref PipeMode  lpMode,
IntPtr  lpMaxCollectionCount,
IntPtr  lpCollectDataTimeout 
)

Sets the read mode and the blocking mode of the specified named pipe.

If the specified handle is to the client end of a named pipe and if the named pipe server process is on a remote computer, the function can also be used to control local buffering.

Parameters
hHandleHandle to the named pipe instance.
lpModePointer to a variable that supplies the new mode.
lpMaxCollectionCountPointer to a variable that specifies the maximum number of bytes collected on the client computer before transmission to the server.
lpCollectDataTimeoutPointer to a variable that specifies the maximum time, in milliseconds, that can pass before a remote named pipe transfers information over the network.
Returns
If the function succeeds, the return value is nonzero.

Referenced by Program.PInvokeNativePipeClient().

static IntPtr PipeNative.CreateFile ( String  lpFileName,
FileDesiredAccess  dwDesiredAccess,
FileShareMode  dwShareMode,
IntPtr  fileSecurityAttributes,
FileCreationDisposition  dwCreationDisposition,
uint  dwFlagsAndAttributes,
uint  hTemplateFile 
)

Creates or opens a file, directory, physical disk, volume, console buffer, tape drive, communications resource, mailslot, or named pipe.

Parameters
lpFileNameFile name.
dwDesiredAccessAccess to the object (reading, writing, or both).
dwShareModeSharing mode of the object (reading, writing, both, or neither).
fileSecurityAttributesPointer to a SecurityAttributes object that determines whether the returned handle can be inherited by child processes.
dwCreationDispositionAction to take on files that exist, and which action to take when files do not exist
dwFlagsAndAttributesFile attributes and flags.
hTemplateFileHandle to a template file.
Returns
If the function succeeds, the return value is an open handle to the specified file.

Referenced by Program.PInvokeNativePipeClient().

static bool PipeNative.ReadFile ( IntPtr  hHandle,
byte[]  lpBuffer,
uint  nNumberOfBytesToRead,
out uint  lpNumberOfBytesRead,
IntPtr  lpOverlapped 
)

Reads data from a file, starting at the position indicated by the file pointer.

Parameters
hHandleHandle to the file to be read.
lpBufferPointer to the buffer that receives the data read from the file.
nNumberOfBytesToReadNumber of bytes to be read from the file.
lpNumberOfBytesReadPointer to the variable that receives the number of bytes read.
lpOverlappedPointer to an Overlapped object.
Returns
The ReadFile function returns when one of the following conditions is met: a write operation completes on the write end of the pipe, the number of bytes requested has been read, or an error occurs.

Referenced by Program.answerSNMP(), Program.listenToSNMP(), Program.PInvokeNativePipeClient(), and Program.PInvokeNativePipeServer().

static bool PipeNative.WriteFile ( IntPtr  hHandle,
byte[]  lpBuffer,
uint  nNumberOfBytesToWrite,
out uint  lpNumberOfBytesWritten,
IntPtr  lpOverlapped 
)

Writes data to a file at the position specified by the file pointer.

Parameters
hHandleHandle to the file.
lpBufferPointer to the buffer containing the data to be written to the file.
nNumberOfBytesToWriteNumber of bytes to be write to the file.
lpNumberOfBytesWrittenPointer to the variable that receives the number of bytes written.
lpOverlappedPointer to an Overlapped object.
Returns
If the function succeeds, the return value is nonzero.

Referenced by Program.answerSNMP(), Program.PInvokeNativePipeClient(), and Program.PInvokeNativePipeServer().

static bool PipeNative.CloseHandle ( IntPtr  hHandle)

Closes an open object handle.

Parameters
hHandleHandle to an open object.
Returns
If the function succeeds, the return value is nonzero.

Referenced by Program.answerSNMP(), Program.listenToSNMP(), Program.PInvokeNativePipeClient(), and Program.PInvokeNativePipeServer().

static bool PipeNative.FlushFileBuffers ( IntPtr  hHandle)

Flushes the buffers of the specified file and causes all buffered data to be written to the file.

Parameters
hHandleHandle to an open file.
Returns
If the function succeeds, the return value is nonzero.

Referenced by Program.answerSNMP(), Program.listenToSNMP(), and Program.PInvokeNativePipeServer().

static bool PipeNative.DisconnectNamedPipe ( IntPtr  hHandle)

Disconnects the server end of a named pipe instance from a client process.

Parameters
hHandleHandle to an instance of a named pipe.
Returns
If the function succeeds, the return value is nonzero.

Referenced by Program.answerSNMP(), Program.listenToSNMP(), and Program.PInvokeNativePipeServer().

static uint PipeNative.GetLastError ( )

Retrieves the calling thread's last-error code value.

Returns
The return value is the calling thread's last-error code value.
static IntPtr PipeNative.CreateNamedPipe ( String  lpName,
PipeOpenMode  dwOpenMode,
PipeMode  dwPipeMode,
uint  nMaxInstances,
uint  nOutBufferSize,
uint  nInBufferSize,
uint  nDefaultTimeOut,
IntPtr  pipeSecurityAttributes 
)

Creates an instance of a named pipe and returns a handle for subsequent pipe operations.

Parameters
lpNamePipe name
dwOpenModePipe open mode
dwPipeModePipe-specific modes
nMaxInstancesMaximum number of instances
nOutBufferSizeOutput buffer size
nInBufferSizeInput buffer size
nDefaultTimeOutTime-out interval
pipeSecurityAttributesSecurity attributes
Returns
If the function succeeds, the return value is a handle to the server end of a named pipe instance.
static bool PipeNative.ConnectNamedPipe ( IntPtr  hHandle,
IntPtr  lpOverlapped 
)

Enables a named pipe server process to wait for a client process to connect to an instance of a named pipe.

Parameters
hHandleHandle to the server end of a named pipe instance.
lpOverlappedPointer to an Overlapped object.
Returns
If the function succeeds, the return value is nonzero.
static bool PipeNative.WaitNamedPipe ( String  name,
int  timeout 
)

Waits until either a time-out interval elapses or an instance of the specified named pipe is available for connection.

Parameters
namePointer to a null-terminated string that specifies the name of the named pipe.
timeoutNumber of milliseconds that the function willwait for an instance of the named pipe to be available.
Returns
If an instance of the pipe is available before the time-out interval elapses, the return value is nonzero.
static bool PipeNative.SetNamedPipeHandleState ( IntPtr  hHandle,
ref PipeMode  lpMode,
IntPtr  lpMaxCollectionCount,
IntPtr  lpCollectDataTimeout 
)

Sets the read mode and the blocking mode of the specified named pipe.

If the specified handle is to the client end of a named pipe and if the named pipe server process is on a remote computer, the function can also be used to control local buffering.

Parameters
hHandleHandle to the named pipe instance.
lpModePointer to a variable that supplies the new mode.
lpMaxCollectionCountPointer to a variable that specifies the maximum number of bytes collected on the client computer before transmission to the server.
lpCollectDataTimeoutPointer to a variable that specifies the maximum time, in milliseconds, that can pass before a remote named pipe transfers information over the network.
Returns
If the function succeeds, the return value is nonzero.
static IntPtr PipeNative.CreateFile ( String  lpFileName,
FileDesiredAccess  dwDesiredAccess,
FileShareMode  dwShareMode,
IntPtr  fileSecurityAttributes,
FileCreationDisposition  dwCreationDisposition,
uint  dwFlagsAndAttributes,
uint  hTemplateFile 
)

Creates or opens a file, directory, physical disk, volume, console buffer, tape drive, communications resource, mailslot, or named pipe.

Parameters
lpFileNameFile name.
dwDesiredAccessAccess to the object (reading, writing, or both).
dwShareModeSharing mode of the object (reading, writing, both, or neither).
fileSecurityAttributesPointer to a SecurityAttributes object that determines whether the returned handle can be inherited by child processes.
dwCreationDispositionAction to take on files that exist, and which action to take when files do not exist
dwFlagsAndAttributesFile attributes and flags.
hTemplateFileHandle to a template file.
Returns
If the function succeeds, the return value is an open handle to the specified file.
static bool PipeNative.ReadFile ( IntPtr  hHandle,
byte[]  lpBuffer,
uint  nNumberOfBytesToRead,
out uint  lpNumberOfBytesRead,
IntPtr  lpOverlapped 
)

Reads data from a file, starting at the position indicated by the file pointer.

Parameters
hHandleHandle to the file to be read.
lpBufferPointer to the buffer that receives the data read from the file.
nNumberOfBytesToReadNumber of bytes to be read from the file.
lpNumberOfBytesReadPointer to the variable that receives the number of bytes read.
lpOverlappedPointer to an Overlapped object.
Returns
The ReadFile function returns when one of the following conditions is met: a write operation completes on the write end of the pipe, the number of bytes requested has been read, or an error occurs.
static bool PipeNative.WriteFile ( IntPtr  hHandle,
byte[]  lpBuffer,
uint  nNumberOfBytesToWrite,
out uint  lpNumberOfBytesWritten,
IntPtr  lpOverlapped 
)

Writes data to a file at the position specified by the file pointer.

Parameters
hHandleHandle to the file.
lpBufferPointer to the buffer containing the data to be written to the file.
nNumberOfBytesToWriteNumber of bytes to be write to the file.
lpNumberOfBytesWrittenPointer to the variable that receives the number of bytes written.
lpOverlappedPointer to an Overlapped object.
Returns
If the function succeeds, the return value is nonzero.
static bool PipeNative.CloseHandle ( IntPtr  hHandle)

Closes an open object handle.

Parameters
hHandleHandle to an open object.
Returns
If the function succeeds, the return value is nonzero.
static bool PipeNative.FlushFileBuffers ( IntPtr  hHandle)

Flushes the buffers of the specified file and causes all buffered data to be written to the file.

Parameters
hHandleHandle to an open file.
Returns
If the function succeeds, the return value is nonzero.
static bool PipeNative.DisconnectNamedPipe ( IntPtr  hHandle)

Disconnects the server end of a named pipe instance from a client process.

Parameters
hHandleHandle to an instance of a named pipe.
Returns
If the function succeeds, the return value is nonzero.
static uint PipeNative.GetLastError ( )

Retrieves the calling thread's last-error code value.

Returns
The return value is the calling thread's last-error code value.
static IntPtr PipeNative.CreateNamedPipe ( String  lpName,
PipeOpenMode  dwOpenMode,
PipeMode  dwPipeMode,
uint  nMaxInstances,
uint  nOutBufferSize,
uint  nInBufferSize,
uint  nDefaultTimeOut,
IntPtr  pipeSecurityAttributes 
)

Creates an instance of a named pipe and returns a handle for subsequent pipe operations.

Parameters
lpNamePipe name
dwOpenModePipe open mode
dwPipeModePipe-specific modes
nMaxInstancesMaximum number of instances
nOutBufferSizeOutput buffer size
nInBufferSizeInput buffer size
nDefaultTimeOutTime-out interval
pipeSecurityAttributesSecurity attributes
Returns
If the function succeeds, the return value is a handle to the server end of a named pipe instance.
static bool PipeNative.ConnectNamedPipe ( IntPtr  hHandle,
IntPtr  lpOverlapped 
)

Enables a named pipe server process to wait for a client process to connect to an instance of a named pipe.

Parameters
hHandleHandle to the server end of a named pipe instance.
lpOverlappedPointer to an Overlapped object.
Returns
If the function succeeds, the return value is nonzero.
static bool PipeNative.WaitNamedPipe ( String  name,
int  timeout 
)

Waits until either a time-out interval elapses or an instance of the specified named pipe is available for connection.

Parameters
namePointer to a null-terminated string that specifies the name of the named pipe.
timeoutNumber of milliseconds that the function will wait for an instance of the named pipe to be available.
Returns
If an instance of the pipe is available before the time-out interval elapses, the return value is nonzero.
static bool PipeNative.SetNamedPipeHandleState ( IntPtr  hHandle,
ref PipeMode  lpMode,
IntPtr  lpMaxCollectionCount,
IntPtr  lpCollectDataTimeout 
)

Sets the read mode and the blocking mode of the specified named pipe.

If the specified handle is to the client end of a named pipe and if the named pipe server process is on a remote computer, the function can also be used to control local buffering.

Parameters
hHandleHandle to the named pipe instance.
lpModePointer to a variable that supplies the new mode.
lpMaxCollectionCountPointer to a variable that specifies the maximum number of bytes collected on the client computer before transmission to the server.
lpCollectDataTimeoutPointer to a variable that specifies the maximum time, in milliseconds, that can pass before a remote named pipe transfers information over the network.
Returns
If the function succeeds, the return value is nonzero.
static IntPtr PipeNative.CreateFile ( String  lpFileName,
FileDesiredAccess  dwDesiredAccess,
FileShareMode  dwShareMode,
IntPtr  fileSecurityAttributes,
FileCreationDisposition  dwCreationDisposition,
uint  dwFlagsAndAttributes,
uint  hTemplateFile 
)

Creates or opens a file, directory, physical disk, volume, console buffer, tape drive, communications resource, mailslot, or named pipe.

Parameters
lpFileNameFile name.
dwDesiredAccessAccess to the object (reading, writing, or both).
dwShareModeSharing mode of the object (reading, writing, both, or neither).
fileSecurityAttributesPointer to a SecurityAttributes object that determines whether the returned handle can be inherited by child processes.
dwCreationDispositionAction to take on files that exist, and which action to take when files do not exist
dwFlagsAndAttributesFile attributes and flags.
hTemplateFileHandle to a template file.
Returns
If the function succeeds, the return value is an open handle to the specified file.
static bool PipeNative.ReadFile ( IntPtr  hHandle,
byte[]  lpBuffer,
uint  nNumberOfBytesToRead,
out uint  lpNumberOfBytesRead,
IntPtr  lpOverlapped 
)

Reads data from a file, starting at the position indicated by the file pointer.

Parameters
hHandleHandle to the file to be read.
lpBufferPointer to the buffer that receives the data read from the file.
nNumberOfBytesToReadNumber of bytes to be read from the file.
lpNumberOfBytesReadPointer to the variable that receives the number of bytes read.
lpOverlappedPointer to an Overlapped object.
Returns
The ReadFile function returns when one of the following conditions is met: a write operation completes on the write end of the pipe, the number of bytes requested has been read, or an error occurs.
static bool PipeNative.WriteFile ( IntPtr  hHandle,
byte[]  lpBuffer,
uint  nNumberOfBytesToWrite,
out uint  lpNumberOfBytesWritten,
IntPtr  lpOverlapped 
)

Writes data to a file at the position specified by the file pointer.

Parameters
hHandleHandle to the file.
lpBufferPointer to the buffer containing the data to be written to the file.
nNumberOfBytesToWriteNumber of bytes to be write to the file.
lpNumberOfBytesWrittenPointer to the variable that receives the number of bytes written.
lpOverlappedPointer to an Overlapped object.
Returns
If the function succeeds, the return value is nonzero.
static bool PipeNative.CloseHandle ( IntPtr  hHandle)

Closes an open object handle.

Parameters
hHandleHandle to an open object.
Returns
If the function succeeds, the return value is nonzero.
static bool PipeNative.FlushFileBuffers ( IntPtr  hHandle)

Flushes the buffers of the specified file and causes all buffered data to be written to the file.

Parameters
hHandleHandle to an open file.
Returns
If the function succeeds, the return value is nonzero.
static bool PipeNative.DisconnectNamedPipe ( IntPtr  hHandle)

Disconnects the server end of a named pipe instance from a client process.

Parameters
hHandleHandle to an instance of a named pipe.
Returns
If the function succeeds, the return value is nonzero.
static uint PipeNative.GetLastError ( )

Retrieves the calling thread's last-error code value.

Returns
The return value is the calling thread's last-error code value.
static IntPtr PipeNative.CreateNamedPipe ( String  lpName,
PipeOpenMode  dwOpenMode,
PipeMode  dwPipeMode,
uint  nMaxInstances,
uint  nOutBufferSize,
uint  nInBufferSize,
uint  nDefaultTimeOut,
IntPtr  pipeSecurityAttributes 
)

Creates an instance of a named pipe and returns a handle for subsequent pipe operations.

Parameters
lpNamePipe name
dwOpenModePipe open mode
dwPipeModePipe-specific modes
nMaxInstancesMaximum number of instances
nOutBufferSizeOutput buffer size
nInBufferSizeInput buffer size
nDefaultTimeOutTime-out interval
pipeSecurityAttributesSecurity attributes
Returns
If the function succeeds, the return value is a handle to the server end of a named pipe instance.
static bool PipeNative.ConnectNamedPipe ( IntPtr  hHandle,
IntPtr  lpOverlapped 
)

Enables a named pipe server process to wait for a client process to connect to an instance of a named pipe.

Parameters
hHandleHandle to the server end of a named pipe instance.
lpOverlappedPointer to an Overlapped object.
Returns
If the function succeeds, the return value is nonzero.
static bool PipeNative.WaitNamedPipe ( String  name,
int  timeout 
)

Waits until either a time-out interval elapses or an instance of the specified named pipe is available for connection.

Parameters
namePointer to a null-terminated string that specifies the name of the named pipe.
timeoutNumber of milliseconds that the function willwait for an instance of the named pipe to be available.
Returns
If an instance of the pipe is available before the time-out interval elapses, the return value is nonzero.
static bool PipeNative.SetNamedPipeHandleState ( IntPtr  hHandle,
ref PipeMode  lpMode,
IntPtr  lpMaxCollectionCount,
IntPtr  lpCollectDataTimeout 
)

Sets the read mode and the blocking mode of the specified named pipe.

If the specified handle is to the client end of a named pipe and if the named pipe server process is on a remote computer, the function can also be used to control local buffering.

Parameters
hHandleHandle to the named pipe instance.
lpModePointer to a variable that supplies the new mode.
lpMaxCollectionCountPointer to a variable that specifies the maximum number of bytes collected on the client computer before transmission to the server.
lpCollectDataTimeoutPointer to a variable that specifies the maximum time, in milliseconds, that can pass before a remote named pipe transfers information over the network.
Returns
If the function succeeds, the return value is nonzero.
static IntPtr PipeNative.CreateFile ( String  lpFileName,
FileDesiredAccess  dwDesiredAccess,
FileShareMode  dwShareMode,
IntPtr  fileSecurityAttributes,
FileCreationDisposition  dwCreationDisposition,
uint  dwFlagsAndAttributes,
uint  hTemplateFile 
)

Creates or opens a file, directory, physical disk, volume, console buffer, tape drive, communications resource, mailslot, or named pipe.

Parameters
lpFileNameFile name.
dwDesiredAccessAccess to the object (reading, writing, or both).
dwShareModeSharing mode of the object (reading, writing, both, or neither).
fileSecurityAttributesPointer to a SecurityAttributes object that determines whether the returned handle can be inherited by child processes.
dwCreationDispositionAction to take on files that exist, and which action to take when files do not exist
dwFlagsAndAttributesFile attributes and flags.
hTemplateFileHandle to a template file.
Returns
If the function succeeds, the return value is an open handle to the specified file.
static bool PipeNative.ReadFile ( IntPtr  hHandle,
byte[]  lpBuffer,
uint  nNumberOfBytesToRead,
out uint  lpNumberOfBytesRead,
IntPtr  lpOverlapped 
)

Reads data from a file, starting at the position indicated by the file pointer.

Parameters
hHandleHandle to the file to be read.
lpBufferPointer to the buffer that receives the data read from the file.
nNumberOfBytesToReadNumber of bytes to be read from the file.
lpNumberOfBytesReadPointer to the variable that receives the number of bytes read.
lpOverlappedPointer to an Overlapped object.
Returns
The ReadFile function returns when one of the following conditions is met: a write operation completes on the write end of the pipe, the number of bytes requested has been read, or an error occurs.
static bool PipeNative.WriteFile ( IntPtr  hHandle,
byte[]  lpBuffer,
uint  nNumberOfBytesToWrite,
out uint  lpNumberOfBytesWritten,
IntPtr  lpOverlapped 
)

Writes data to a file at the position specified by the file pointer.

Parameters
hHandleHandle to the file.
lpBufferPointer to the buffer containing the data to be written to the file.
nNumberOfBytesToWriteNumber of bytes to be write to the file.
lpNumberOfBytesWrittenPointer to the variable that receives the number of bytes written.
lpOverlappedPointer to an Overlapped object.
Returns
If the function succeeds, the return value is nonzero.
static bool PipeNative.CloseHandle ( IntPtr  hHandle)

Closes an open object handle.

Parameters
hHandleHandle to an open object.
Returns
If the function succeeds, the return value is nonzero.
static bool PipeNative.FlushFileBuffers ( IntPtr  hHandle)

Flushes the buffers of the specified file and causes all buffered data to be written to the file.

Parameters
hHandleHandle to an open file.
Returns
If the function succeeds, the return value is nonzero.
static bool PipeNative.DisconnectNamedPipe ( IntPtr  hHandle)

Disconnects the server end of a named pipe instance from a client process.

Parameters
hHandleHandle to an instance of a named pipe.
Returns
If the function succeeds, the return value is nonzero.
static uint PipeNative.GetLastError ( )

Retrieves the calling thread's last-error code value.

Returns
The return value is the calling thread's last-error code value.
static IntPtr PipeNative.CreateNamedPipe ( String  lpName,
PipeOpenMode  dwOpenMode,
PipeMode  dwPipeMode,
uint  nMaxInstances,
uint  nOutBufferSize,
uint  nInBufferSize,
uint  nDefaultTimeOut,
IntPtr  pipeSecurityAttributes 
)

Creates an instance of a named pipe and returns a handle for subsequent pipe operations.

Parameters
lpNamePipe name
dwOpenModePipe open mode
dwPipeModePipe-specific modes
nMaxInstancesMaximum number of instances
nOutBufferSizeOutput buffer size
nInBufferSizeInput buffer size
nDefaultTimeOutTime-out interval
pipeSecurityAttributesSecurity attributes
Returns
If the function succeeds, the return value is a handle to the server end of a named pipe instance.
static bool PipeNative.ConnectNamedPipe ( IntPtr  hHandle,
IntPtr  lpOverlapped 
)

Enables a named pipe server process to wait for a client process to connect to an instance of a named pipe.

Parameters
hHandleHandle to the server end of a named pipe instance.
lpOverlappedPointer to an Overlapped object.
Returns
If the function succeeds, the return value is nonzero.
static bool PipeNative.WaitNamedPipe ( String  name,
int  timeout 
)

Waits until either a time-out interval elapses or an instance of the specified named pipe is available for connection.

Parameters
namePointer to a null-terminated string that specifies the name of the named pipe.
timeoutNumber of milliseconds that the function will wait for an instance of the named pipe to be available.
Returns
If an instance of the pipe is available before the time-out interval elapses, the return value is nonzero.
static bool PipeNative.SetNamedPipeHandleState ( IntPtr  hHandle,
ref PipeMode  lpMode,
IntPtr  lpMaxCollectionCount,
IntPtr  lpCollectDataTimeout 
)

Sets the read mode and the blocking mode of the specified named pipe.

If the specified handle is to the client end of a named pipe and if the named pipe server process is on a remote computer, the function can also be used to control local buffering.

Parameters
hHandleHandle to the named pipe instance.
lpModePointer to a variable that supplies the new mode.
lpMaxCollectionCountPointer to a variable that specifies the maximum number of bytes collected on the client computer before transmission to the server.
lpCollectDataTimeoutPointer to a variable that specifies the maximum time, in milliseconds, that can pass before a remote named pipe transfers information over the network.
Returns
If the function succeeds, the return value is nonzero.
static IntPtr PipeNative.CreateFile ( String  lpFileName,
FileDesiredAccess  dwDesiredAccess,
FileShareMode  dwShareMode,
IntPtr  fileSecurityAttributes,
FileCreationDisposition  dwCreationDisposition,
uint  dwFlagsAndAttributes,
uint  hTemplateFile 
)

Creates or opens a file, directory, physical disk, volume, console buffer, tape drive, communications resource, mailslot, or named pipe.

Parameters
lpFileNameFile name.
dwDesiredAccessAccess to the object (reading, writing, or both).
dwShareModeSharing mode of the object (reading, writing, both, or neither).
fileSecurityAttributesPointer to a SecurityAttributes object that determines whether the returned handle can be inherited by child processes.
dwCreationDispositionAction to take on files that exist, and which action to take when files do not exist
dwFlagsAndAttributesFile attributes and flags.
hTemplateFileHandle to a template file.
Returns
If the function succeeds, the return value is an open handle to the specified file.
static bool PipeNative.ReadFile ( IntPtr  hHandle,
byte[]  lpBuffer,
uint  nNumberOfBytesToRead,
out uint  lpNumberOfBytesRead,
IntPtr  lpOverlapped 
)

Reads data from a file, starting at the position indicated by the file pointer.

Parameters
hHandleHandle to the file to be read.
lpBufferPointer to the buffer that receives the data read from the file.
nNumberOfBytesToReadNumber of bytes to be read from the file.
lpNumberOfBytesReadPointer to the variable that receives the number of bytes read.
lpOverlappedPointer to an Overlapped object.
Returns
The ReadFile function returns when one of the following conditions is met: a write operation completes on the write end of the pipe, the number of bytes requested has been read, or an error occurs.
static bool PipeNative.WriteFile ( IntPtr  hHandle,
byte[]  lpBuffer,
uint  nNumberOfBytesToWrite,
out uint  lpNumberOfBytesWritten,
IntPtr  lpOverlapped 
)

Writes data to a file at the position specified by the file pointer.

Parameters
hHandleHandle to the file.
lpBufferPointer to the buffer containing the data to be written to the file.
nNumberOfBytesToWriteNumber of bytes to be write to the file.
lpNumberOfBytesWrittenPointer to the variable that receives the number of bytes written.
lpOverlappedPointer to an Overlapped object.
Returns
If the function succeeds, the return value is nonzero.
static bool PipeNative.CloseHandle ( IntPtr  hHandle)

Closes an open object handle.

Parameters
hHandleHandle to an open object.
Returns
If the function succeeds, the return value is nonzero.
static bool PipeNative.FlushFileBuffers ( IntPtr  hHandle)

Flushes the buffers of the specified file and causes all buffered data to be written to the file.

Parameters
hHandleHandle to an open file.
Returns
If the function succeeds, the return value is nonzero.
static bool PipeNative.DisconnectNamedPipe ( IntPtr  hHandle)

Disconnects the server end of a named pipe instance from a client process.

Parameters
hHandleHandle to an instance of a named pipe.
Returns
If the function succeeds, the return value is nonzero.

Member Data Documentation

const uint PipeNative.PIPE_UNLIMITED_INSTANCES = 255

Unlimited server pipe instances.

Referenced by Program.answerSNMP(), Program.listenToSNMP(), and Program.PInvokeNativePipeServer().

const ulong PipeNative.ERROR_SUCCESS = 0

The operation completed successfully.

const ulong PipeNative.ERROR_CANNOT_CONNECT_TO_PIPE = 2

The system cannot find the file specified.

const ulong PipeNative.ERROR_PIPE_BUSY = 231

All pipe instances are busy.

Referenced by Program.PInvokeNativePipeClient().

const ulong PipeNative.ERROR_NO_DATA = 232

The pipe is being closed.

const ulong PipeNative.ERROR_PIPE_NOT_CONNECTED = 233

No process is on the other end of the pipe.

const ulong PipeNative.ERROR_MORE_DATA = 234

More data is available.

Referenced by Program.PInvokeNativePipeClient().

const ulong PipeNative.ERROR_PIPE_CONNECTED = 535

There is a process on other end of the pipe.

Referenced by Program.answerSNMP(), Program.listenToSNMP(), and Program.PInvokeNativePipeServer().

const ulong PipeNative.ERROR_PIPE_LISTENING = 536

Waiting for a process to open the other end of the pipe.

const uint PipeNative.NMPWAIT_WAIT_FOREVER = 0xffffffff

Waits indefinitely when connecting to a pipe.

const uint PipeNative.NMPWAIT_NOWAIT = 0x00000001

Does not wait for the named pipe.

const uint PipeNative.NMPWAIT_USE_DEFAULT_WAIT = 0x00000000

Uses the default time-out specified in a call to the CreateNamedPipe method.

Referenced by Program.answerSNMP(), Program.listenToSNMP(), and Program.PInvokeNativePipeServer().

const int PipeNative.INVALID_HANDLE_VALUE = -1

The documentation for this class was generated from the following file: