コード例 #1
0
 /// <summary>
 /// Defaults when creating an instance of <see cref="ClientSocket"/>
 /// </summary>
 protected void SetDefaults()
 {
     this.OnReceivedInvokeAsynchronously = false;
     if (this.BufferCodec == null)
     {
         this.BufferCodec = XmlBufferCodec.SingletonInstance();
     }
 }
コード例 #2
0
        public TestServer()
        {
            IPv4       = "127.0.0.1";
            IPv4PortNo = 8090;

            // the default codec for this server is xml, each client that connects
            // will be given the Xml Codec, which can be changed on a one-by-one basis.
            DefaultBufferCodec = new XmlBufferCodec();

            // event handler for all echo commands received from clients.
            AddReceiveEventHandler(typeof(EchoCommand), OnEcho);
            AddReceiveEventHandler(typeof(WhatTimeIsItCommand), OnWhatTimeIsIt);
        }