Exemplo n.º 1
0
        private void log(int severity, string message)
        {
            try
            {
                //
                // Create a syslog message as defined by the RFC 3164:
                // <PRI>HEADER MSG. PRI is the priority and is calculated
                // from the facility and the severity. We don't specify
                // the HEADER. MSG contains the identifier followed by a
                // colon character and the message.
                //

                int priority = (_facility << 3) | severity;

                string msg = '<' + priority + '>' + _ident + ": " + message;

                byte[] buf = new byte[msg.Length];
                for (int i = 0; i < msg.Length; i++)
                {
                    buf[i] = (byte)msg[i];
                }
                _socket.Send(buf, buf.Length);
            }
            catch (System.IO.IOException ex)
            {
                Ice.SocketException se = new Ice.SocketException(ex);
                throw se;
            }
        }
Exemplo n.º 2
0
 private void exception(Ice.Current current)
 {
     if (current.operation.Equals("ice_ids"))
     {
         throw new Test.TestIntfUserException();
     }
     else if (current.operation.Equals("requestFailedException"))
     {
         throw new Ice.ObjectNotExistException();
     }
     else if (current.operation.Equals("unknownUserException"))
     {
         var ex = new Ice.UnknownUserException();
         ex.unknown = "reason";
         throw ex;
     }
     else if (current.operation.Equals("unknownLocalException"))
     {
         var ex = new Ice.UnknownLocalException();
         ex.unknown = "reason";
         throw ex;
     }
     else if (current.operation.Equals("unknownException"))
     {
         var ex = new Ice.UnknownException();
         ex.unknown = "reason";
         throw ex;
     }
     else if (current.operation.Equals("userException"))
     {
         throw new Test.TestIntfUserException();
     }
     else if (current.operation.Equals("localException"))
     {
         var ex = new Ice.SocketException();
         ex.error = 0;
         throw ex;
     }
     else if (current.operation.Equals("csException"))
     {
         throw new System.Exception("message");
     }
     else if (current.operation.Equals("unknownExceptionWithServantException"))
     {
         throw new Ice.UnknownException("reason");
     }
     else if (current.operation.Equals("impossibleException"))
     {
         throw new Test.TestIntfUserException(); // Yes, it really is meant to be TestIntfException.
     }
     else if (current.operation.Equals("intfUserException"))
     {
         throw new Test.TestImpossibleException(); // Yes, it really is meant to be TestImpossibleException.
     }
     else if (current.operation.Equals("asyncResponse"))
     {
         throw new Test.TestImpossibleException();
     }
     else if (current.operation.Equals("asyncException"))
     {
         throw new Test.TestImpossibleException();
     }
 }
Exemplo n.º 3
0
 private void log(int severity, string message)
 {
     try
     {
         //
         // Create a syslog message as defined by the RFC 3164:
         // <PRI>HEADER MSG. PRI is the priority and is calculated
         // from the facility and the severity. We don't specify
         // the HEADER. MSG contains the identifier followed by a
         // colon character and the message.
         //
         
         int priority = (_facility << 3) | severity;
         
         string msg = '<' + priority + '>' + _ident + ": " + message;
         
         byte[] buf = new byte[msg.Length];
         for(int i = 0; i < msg.Length; i++)
         {
             buf[i] = (byte)msg[i];
         }
         _socket.Send(buf, buf.Length);
     }
     catch(System.IO.IOException ex)
     {
         Ice.SocketException se = new Ice.SocketException(ex);
         throw se;
     }
 }