# NNS_McsOpenStream

## Syntax

      #include <nnsys/mcs.h>

      HANDLE NNS_McsOpenStream(
                 USHORT  channel,
                 DWORD   flags);

## Arguments

`channel` | Value for identifying a stream. Specify in the range of 0 to `0x3FFF`. The range of `0x4000` to `0x7FFF` is reserved for TWL-System applications. The range of `0x8000` to `0xFFFF` is reserved for the MCS system.
`flags` | Flags specified when stream is opened. (For details, see Description.)

## Return Values

If the stream is successfully opened, the function returns the stream's handle. If the process fails, the function returns `INVALID_HANDLE_VALUE`. Use the `GetLastError` function to get details about the error.

## Description

Opens a stream for Multiple Channel Stream. Streams are actually pipes that have attached message type names in the Win32 system, and the return value is a handle for one of these name-attached pipes. The `NNS_McsOpenStream` function opens a pipe with an attached message type name, and registers the value identifying the stream specified by the `channel` argument to the MCS server.

To read and write to the stream, use the Win32 API's `ReadFile(Ex)` and `WriteFile(Ex)` functions.

For the `flag` argument, specify 0 or the values shown below. This value is passed to the sixth argument (`dwFlagsAndAttributes`) in the Win32 API's `CreateFile` function.

`FILE_FLAG_OVERLAPPED` | Inputs/outputs asynchronously (overlapped I/O). For details, see the explanation of `CreateFile` in the Win32 API.

## See Also

`NNS_McsOpenStreamEx`

## Revision History

2008/06/20 Changed NITRO-System to TWL-System.
2005/01/11 Added Description.
2004/10/08 Added a description of the `channel` argument.
2004/07/20 Added references. 2004/06/01 Initial version.

CONFIDENTIAL