All instances Pipe Are busy - c# NamedPipeServerStream

1.6k Views Asked by At

im trying to use pipe via .net v4.0 on winforms application background

heres my code -->

public void main()
{
    using (NamedPipeServerStream pipeserver = new NamedPipeServerStream("colors", PipeDirection.Out,4))
    {

        pipeserver.WaitForConnection();
        try
        {
            using (StreamReader sr = new StreamReader(pipeserver))
            {
                string data = sr.ReadLine();
                ConvertToGuiColor(data);
            }
        }
        catch (Exception ex)
        {
            MessageBox.Show(ex.ToString());
        }
    }
}

trying to understand why Exception "All instances Pipe Are busy" thought maybe because

pipeserver.WaitForConnection();

,but the Exception is throwing in this : "using (NamedPipeServerStream pipeserver = new NamedPipeServerStream("colors", PipeDirection.Out,4))" command

ty for helpers sKY Walker

0

There are 0 best solutions below