Note that there are some explanatory texts on larger screens.

plurals
  1. PODuplex named pipes - maximum number of clients on a single pipe
    primarykey
    data
    text
    <p>Using the code from this answer - <a href="https://stackoverflow.com/questions/16432813/async-two-way-communication-with-windows-named-pipes-net">Async two-way communication with Windows Named Pipes (.Net)</a> - I'm finding the maximum number of connections/clients at any one time is 10.</p> <p>In the crude example below (this uses multiple threads - same thing happens if multiple processes are used) clients 1 to 10 will start and run as normal. However clients 11 and 12 will block when 'ProcessData' is called, eventually throwing a TimeoutException.</p> <pre><code> public static void Start() { // Start Server new Thread(new ThreadStart(Server.MainRun)).Start(); // Start Clients for (int i = 1; i &lt;= 12; i++) { Thread.Sleep(500); Client c = new Client(i.ToString()); new Thread(new ThreadStart(c.Run)).Start(); } } // Create a contract that can be used as a callback public interface IMyCallbackService { [OperationContract(IsOneWay = true)] void NotifyClient(); } // Define your service contract and specify the callback contract [ServiceContract(CallbackContract = typeof(IMyCallbackService))] public interface ISimpleService { [OperationContract] string ProcessData(); } [ServiceBehavior(InstanceContextMode = InstanceContextMode.PerCall)] public class SimpleService : ISimpleService { public string ProcessData() { // Get a handle to the call back channel var callback = OperationContext.Current.GetCallbackChannel&lt;IMyCallbackService&gt;(); callback.NotifyClient(); return DateTime.Now.ToString(); } } class Server { public static void MainRun() { // Create a service host with an named pipe endpoint using (var host = new ServiceHost(typeof(SimpleService), new Uri("net.pipe://localhost"))) { host.AddServiceEndpoint(typeof(ISimpleService), new NetNamedPipeBinding(), "SimpleService"); host.Open(); Console.WriteLine("Simple Service Running..."); Console.ReadLine(); host.Close(); } } } class Client : IMyCallbackService { string _id; public Client(string ID) { _id = ID; } public void Run() { Console.WriteLine("Starting client : " + _id); // Consume the service var factory = new DuplexChannelFactory&lt;ISimpleService&gt;(new InstanceContext(this), new NetNamedPipeBinding(), new EndpointAddress("net.pipe://localhost/SimpleService")); var proxy = factory.CreateChannel(); Console.WriteLine(proxy.ProcessData()); Console.WriteLine("Client finished : " + _id); } public void NotifyClient() { Console.WriteLine("Notification from Server"); } } </code></pre> <p>If the client closes the channel when done (factory.Close()) then all clients will be able to run.</p> <p>I understand this question - <a href="https://stackoverflow.com/questions/1266849/number-of-clients-that-can-connect-to-a-named-pipe">Number of Clients that can connect to a Named Pipe</a> - is very similar but suggests there is no low limit.</p> <p>This suggests the limit is 10 on Windows XP and 2000 machines - <a href="http://msdn.microsoft.com/en-us/library/system.io.pipes.namedpipeclientstream.aspx" rel="nofollow noreferrer">http://msdn.microsoft.com/en-us/library/system.io.pipes.namedpipeclientstream.aspx</a> - except this is happening on a Windows 8 machine and Windows 2008 server.</p> <p>Is there a way to change this limit? Am I missing something obvious?</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload