Otp.OtpOutputStream.writeTo C# (CSharp) Метод

writeTo() публичный Метод

public writeTo ( System os ) : void
os System
Результат void
        public virtual void  writeTo(System.IO.Stream os)
        {
            os.Write(buf, 0, _count);
            os.Flush();
        }

Usage Example

Пример #1
0
        // Ask epmd to close his end of the connection.
        // Caller should close his epmd socket as well.
        // This method is pretty forgiving...

        /*
         * Unregister from Epmd. Other nodes wishing to connect will no
         * longer be able to.
         *
         * <p> This method does not report any failures.
         **/
        public static void  unPublishPort(OtpLocalNode node)
        {
            TcpClient s = null;

            try
            {
                s = new TcpClient(System.Net.Dns.GetHostName(), epmdPort);
                OtpOutputStream obuf = new OtpOutputStream();
                obuf.write2BE(node.getAlive().Length + 1);
                obuf.write1(stopReq);
                //UPGRADE_NOTE: This code will be optimized in the future;
                byte[] tmpBytes;
                int    i;
                string tmpStr;
                tmpStr   = node.getAlive();
                tmpBytes = new byte[tmpStr.Length];
                i        = 0;
                while (i < tmpStr.Length)
                {
                    tmpBytes[i] = (byte)tmpStr[i];
                    i++;
                }
                obuf.writeN(tmpBytes);
                obuf.writeTo((System.IO.Stream)s.GetStream());
                // don't even wait for a response (is there one?)
                if (traceLevel >= traceThreshold)
                {
                    OtpTrace.TraceEvent("-> UNPUBLISH " + node + " port=" + node.port());
                    OtpTrace.TraceEvent("<- OK (assumed)");
                }
            }
            catch (System.Exception)
            {
                /*ignore all failures */
            }
            finally
            {
                try
                {
                    if (s != null)
                    {
                        s.Close();
                    }
                }
                catch (System.IO.IOException)
                {
                    /*ignore close failure */
                }
                s = null;
            }
        }
All Usage Examples Of Otp.OtpOutputStream::writeTo