Example #1
0
        private string SendRecieveString(string any)
        {
            ClientPipeConnection clientConnection = null;
            try
            {
                clientConnection = new ClientPipeConnection(_pipeName, ".");
                if (!clientConnection.TryConnect())
                {
                    clientConnection.Dispose();
                    return null;
                }

                clientConnection.Write(any);
                string response = clientConnection.Read();
                clientConnection.Close();
                clientConnection.Dispose();
                return response;
            }
            catch (Exception exception)
            {
                if (null != clientConnection)
                    clientConnection.Dispose();
                throw (exception);
            }
        }
Example #2
0
        private string SendRecieveString(string any)
        {
            ClientPipeConnection clientConnection = null;

            try
            {
                clientConnection = new ClientPipeConnection(_pipeName, ".");
                if (!clientConnection.TryConnect())
                {
                    clientConnection.Dispose();
                    return(null);
                }

                clientConnection.Write(any);
                string response = clientConnection.Read();
                clientConnection.Close();
                clientConnection.Dispose();
                return(response);
            }
            catch (Exception exception)
            {
                if (null != clientConnection)
                {
                    clientConnection.Dispose();
                }
                throw (exception);
            }
        }