Export (0) Print
Expand All

NamedPipeClientStream.Connect Method (Int32)

Connects to a waiting server within the specified time-out period.

Namespace:  System.IO.Pipes
Assembly:  System.Core (in System.Core.dll)

public void Connect(
	int timeout
)

Parameters

timeout
Type: System.Int32

The number of milliseconds to wait for the server to respond before the connection times out.

ExceptionCondition
TimeoutException

Could not connect to the server within the specified timeout period.

ArgumentOutOfRangeException

timeout is less than 0 and not set to Infinite.

InvalidOperationException

The client is already connected.

IOException

The server is connected to another client and the time-out period has expired.

This method waits for a pipe instance to become available. Connect might return before WaitForConnection is called from the NamedPipeServerStream, but WaitForConnection will not return until Connect has returned. You set the timeout parameter to Infinite to specify an infinite time-out value.

Any data written to the pipe after a NamedPipeClientStream object has connected, but before the server has called WaitForConnection, will be available to the server following the call to WaitForConnection.

.NET Framework

Supported in: 4.5.2, 4.5.1, 4.5, 4, 3.5

.NET Framework Client Profile

Supported in: 4, 3.5 SP1

Windows 8.1, Windows Server 2012 R2, Windows 8, Windows Server 2012, Windows 7, Windows Vista SP2, Windows Server 2008 (Server Core Role not supported), Windows Server 2008 R2 (Server Core Role supported with SP1 or later; Itanium not supported)

The .NET Framework does not support all versions of every platform. For a list of the supported versions, see .NET Framework System Requirements.

Show:
© 2014 Microsoft