Craig Shearer
Craig Shearer

Reputation: 14541

Timeout on a NamedPipe in C#

I have a couple of apps talking to each other, and I use a NamedPipe. But if the other app isn't available then the NamedPipe waits for ever to connect. It also doesn't support timeouts.

What's the right way to do this?

Upvotes: 2

Views: 3727

Answers (1)

JaredPar
JaredPar

Reputation: 755587

Are you using the NamedPipeClientStream class? If so there is an overload of Connect which takes a timeout value. That will allow you to specify how long you wait before giving up.

Upvotes: 5

Related Questions