|
Named Pipe Modes
A number of modes associated with a named pipe or with a handle to a named
pipe affect the use and behavior of the pipe. Some of these modes can be set
differently for each handle to a pipe, while others must be the same for all handles
to a pipe.
The server process specifies the following modes when it calls the CreateNamedPipe function. The type and access modes must be the same for all instances of a
pipe.
Mode
| Meaning
| Type
| PIPE_TYPE_BYTE or PIPE_TYPE_MESSAGE. The type mode determines whether data is
written to a named pipe as a stream of messages or as a stream of bytes. If no
type is specified in CreateNamedPipe, the default is PIPE_TYPE_BYTE. A handle to a byte pipe must be in byte-read
mode. A handle to a message pipe can be in either byte-read or message-read
mode. For more information about pipe types, see Named Pipe Type and Read Mode.
| Access
| PIPE_ACCESS_INBOUND, PIPE_ACCESS_OUTBOUND, or PIPE_ACCESS_DUPLEX. This mode is
equivalent to specifying the read or write access of the server's handles to
the pipe, where inbound is equivalent to GENERIC_READ access, outbound is
equivalent to GENERIC_WRITE access, and duplex is equivalent to GENERIC_READ |
GENERIC_WRITE access. Client processes using the CreateFile function to connect to a named pipe must specify an access compatible with
the access specified by the server. For example, a client must specify
GENERIC_READ access for an outbound pipe.
|
The remaining pipe modes can differ for each pipe handle. This means that the
client and server ends of the same pipe instance can use different modes. CreateNamedPipe sets all of these modes for the pipe handles of a server. CreateFile supports setting the overlapped and write-through modes for the pipe handles
of a client. Both client and server processes use the SetNamedPipeHandleState function to set the read and wait modes of a pipe handle.
Mode
| Meaning
| Read
| PIPE_READMODE_BYTE or PIPE_READMODE_MESSAGE. In byte-read mode, data is read
from a named pipe as a stream of bytes. In message-read mode, data is read from
a named pipe as a stream of messages. Only byte-read mode is allowed for
byte-type pipes. Either byte-read or message-read mode is allowed for message-type
pipes. The default is byte-type mode, if no read mode is specified in CreateNamedPipe. For more information about read modes, see Named Pipe Type and Read Mode.
| Wait
| PIPE_WAIT or PIPE_NOWAIT. In blocking-wait mode, the ReadFile, WriteFile, and ConnectNamedPipe functions wait indefinitely in some situations for a process on the other
end of the pipe to perform an action. In nonblocking-wait mode, the functions
return if they cannot finish their operations immediately. For more information
about wait modes, see Blocking and Nonblocking Pipe Operations.
| Overlapped
| FILE_FLAG_OVERLAPPED. In overlapped mode, functions performing read, write,
and connect operations that take a significant time to be completed can return
immediately. This enables the thread to perform other operations while a
time-consuming operation executes in the background. For more information about
overlapped mode, see Synchronous and Overlapped Input and Output.
| Write-through
| FILE_FLAG_WRITE_THROUGH. In write-through mode, the functions that write to a
named pipe do not return until the data written is transmitted across the
network and into the pipe's buffer on the remote computer. This mode affects only
write operations on byte-type pipes and, then, only when the client and server
processes are on different computers. If write-through mode is not enabled, a
write function returns successfully, even if the data is not transmitted. For more
information about write-through modes, see Write-through to Remote Clients.
|
The initial read mode for a pipe handle is specified when a server process
calls CreateNamedPipe. If PIPE_READMODE_BYTE is specified or if no read mode is specified, the pipe
handle is created in byte-read mode. If both PIPE_READMODE_MESSAGE and
PIPE_TYPE_MESSAGE are specified, the handle is created in message-read mode. For a
client process, a pipe handle returned by CreateFile is always in byte-read mode initially. Both client and server processes can
use the SetNamedPipeHandleState function to change the read mode of a pipe handle. For a message-type pipe,
the read mode can be different for server and client handles to the same pipe
instance.
| Last news from Greatis Software |
 |
|
Nostalgia .Net |
|
.Net is powerful, but not all-powerful, so sometimes we need to use Win32 API for our .Net applications. It's simple enough with Platform Invoke if you have Win32 skill, but we do not always have time to dig the ancient documentation, declare the special types that are compatible with Win32, find the values of the Win32's constants and so on. Nostalgia .Net offers several simple-to-use classes, and components that will allow you to forget about the headache of Win32 and just use the power of Win32 in your application the same way as you use the native. Net classes. More » |
| Recommended software for developers |
 |
|
Ultimate Pack |
|
Component pack for Delphi and C++ Builder that contains runtime form designer, runtime object inspector, print suite and much more for the very special price. More » |
 |
|
Form Designer .Net |
|
Unique runtime form design solution that allows to edit any form in .Net WinForms application at runtime with full source codes for only 300 euro! More » |
 |
|
Print Suite .Net |
|
Print Suite .Net is a set of components for easy printing texts, images and grids from your WinForms applications. Full C# source codes are available More » |
 |
|
Gradient Controls .Net |
|
Gradient Controls .Net offers controls with gradient background feature. Labels, panels and so on... Full C# source codes are available More » |
 |
|
Greatis iGrid |
|
iGrid plots drawing grid right over your desktop, so you can use it everywhere, with any drawing application without any special plugins for different graphic editors. More » |
All the contacts and projectsDmitry Vasiliev (just.dmitry)
Related LinksSoftware for Visual Studio .NET developers Software for Delphi and C++ Builder developers Software for Visual Basic 6 developers Delphi Tips&Tricks MegaDetailed.NET More Online Helps Win32 Programmer's Reference Win32 Multimedia Programmer's Reference OLE Programmer's Reference Microsoft Windows Pen API Programmer's Reference Microsoft Windows Sockets 2 Reference Microsoft Windows Telephony API (TAPI) Programmer's Reference Unix Manual Pages
|