NamedPipeServerStream hanging on write operation

I have just started working on a general-purpose library called BlueLib: https://github.com/gaxar77/BlueLib/blob/master/BlueLib/

I am working on an inter process messaging mechanism using named pipes. The problem is that when a message comes through one pipe and is sent out by the server to another, the write operation hangs and the read operations hangs in the client. I do not understand why this is happening. All the files are shown at the above link. The server hangs at the following location in MessageUtility.cs
        public static bool WriteElement(PipeStream stream, XElement element)
        {
            string elementText = element.ToString();
            byte[] bytes = Encoding.Unicode.GetBytes(elementText);

            try
            {
                stream.Write(bytes, 0, bytes.Length);

                return true;
            }
            catch (Exception exception)
            {
                return false;
            }
        }

Does anyone have any idea as to what is going on?

Comments

Sign In or Register to comment.