getOtpInputStream() private method

private getOtpInputStream ( int offset ) : OtpInputStream
offset int
return OtpInputStream
示例#1
0
 // used by the other message types
 protected internal virtual void  do_send(OtpOutputStream header)
 {
     lock(this)
     {
         try
         {
             if (traceLevel >= OtpTrace.Type.ctrlThreshold)
             {
                 try
                 {
                     Erlang.Object h = (header.getOtpInputStream(5)).read_any();
                     OtpTrace.TraceEvent("-> " + headerType(h) + " " + h);
                 }
                 catch (Erlang.Exception e)
                 {
                     OtpTrace.TraceEvent("   " + "can't decode output buffer: " + e);
                 }
             }
             header.writeTo((System.IO.Stream) socket.GetStream());
         }
         catch (System.Net.Sockets.SocketException e)
         {
             close();
             throw e;
         }
         catch (System.IO.IOException e)
         {
             close();
             throw e;
         }
     }
 }
示例#2
0
        // used by  send and send_reg (message types with payload)
        protected internal virtual void  do_send(OtpOutputStream header, OtpOutputStream payload)
        {
            lock(this)
            {
                try
                {
                    if (traceLevel >= OtpTrace.Type.sendThreshold)
                    {
                        // Need to decode header and output buffer to show trace message!
                        // First make OtpInputStream, then decode.
                        try
                        {
                            if (traceLevel >= OtpTrace.Type.wireThreshold)
                            {
                                Erlang.Object h = (header.getOtpInputStream(5)).read_any();
                                Erlang.Binary hb = header.ToBinary();
                                Erlang.Binary ob = payload.ToBinary();
                                System.Text.StringBuilder s = new System.Text.StringBuilder();
                                s.AppendFormat("-> {0} {1} (header_sz={2}, msg_sz={3})\n" +
                                               "   Header: {4}\n" +
                                               "   Msg:    {5}", headerType(h), h.ToString(), hb.size(), ob.size(),
                                                                 hb.ToBinaryString(), ob.ToBinaryString());
                                OtpTrace.TraceEvent(s.ToString());
                                h  = null;
                                hb = null;
                                ob = null;
                            }
                            else
                            {
                                Erlang.Object h = (header.getOtpInputStream(5)).read_any();
                                OtpTrace.TraceEvent("-> " + headerType(h) + " " + h.ToString());
                                Erlang.Object o = (payload.getOtpInputStream(0)).read_any();
                                OtpTrace.TraceEvent("   " + o.ToString());
                                h = null;
                                o = null;
                            }
                        }
                        catch (Erlang.Exception e)
                        {
                            OtpTrace.TraceEvent("   " + "can't decode output buffer:" + e);
                        }
                    }
                    
                    header.writeTo((System.IO.Stream) socket.GetStream());
                    payload.writeTo((System.IO.Stream) socket.GetStream());

                    long written = header.count() + payload.count();
                    sentBytes += written;
                    sentMsgs++;
                    if (onReadWrite != null)
                        onReadWrite(this, Operation.Write, written, sentBytes, sentMsgs);
                }
                catch (System.Exception e)
                {
                    close();
                    throw e;
                }
            }
        }
示例#3
0
 // used by  send and send_reg (message types with payload)
 protected internal virtual void  do_send(OtpOutputStream header, OtpOutputStream payload)
 {
     lock(this)
     {
         try
         {
             if (traceLevel >= OtpTrace.Type.sendThreshold)
             {
                 // Need to decode header and output buffer to show trace message!
                 // First make OtpInputStream, then decode.
                 try
                 {
                     Erlang.Object h = (header.getOtpInputStream(5)).read_any();
                     OtpTrace.TraceEvent("-> " + headerType(h) + " " + h.ToString());
                     
                     Erlang.Object o = (payload.getOtpInputStream(0)).read_any();
                     OtpTrace.TraceEvent("   " + o.ToString());
                     o = null;
                 }
                 catch (Erlang.Exception e)
                 {
                     OtpTrace.TraceEvent("   " + "can't decode output buffer:" + e);
                 }
             }
             
             header.writeTo((System.IO.Stream) socket.GetStream());
             payload.writeTo((System.IO.Stream) socket.GetStream());
         }
         catch (System.Net.Sockets.SocketException e)
         {
             close();
             throw e;
         }
         catch (System.IO.IOException e)
         {
             close();
             throw e;
         }
     }
 }
示例#4
0
 // used by the other message types
 protected internal virtual void do_send(OtpOutputStream header)
 {
     lock(this)
     {
         try
         {
             if (traceLevel >= ctrlThreshold)
             {
                 try
                 {
                     Erlang.Object h = (header.getOtpInputStream(5)).read_any();
                     System.Console.Out.WriteLine("-> " + headerType(h) + " " + h);
                 }
                 catch (Erlang.DecodeException e)
                 {
                     System.Console.Out.WriteLine("   " + "can't decode output buffer: " + e);
                 }
             }
             header.writeTo((System.IO.Stream) socket.GetStream());
         }
         catch (System.IO.IOException e)
         {
             close();
             throw e;
         }
     }
 }