예제 #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);
            }
        }
예제 #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);
            }
        }