/// <summary>
 /// Initializes a new instance of the SiS.Communication.Process.ShareMemoryBase
 /// </summary>
 /// <param name="uniqueName">An unique name for share memory communication</param>
 /// <param name="bufferSize">The buffer size of the share memory</param>
 public ShareMemoryBase(string uniqueName, int bufferSize)
 {
     _uniqueName    = uniqueName;
     _bufferSize    = bufferSize;
     _packetSpliter = new SimplePacketSpliter();
     _sendBuffer    = new DynamicBuffer();
 }
Beispiel #2
0
        public TcpBasicServerViewModel()
        {
            //1.the default spliter
            //IPacketSpliter spliter = new SimplePacketSpliter();

            //2.packet with specific header which can prevent illegal network connection
            IPacketSpliter headerSpliter = new HeaderPacketSpliter(0xFFFF1111);

            //3.packet with length ahead in network byte order
            IPacketSpliter simpleSpliter = new SimplePacketSpliter(true);

            //4.packet end with specific mark
            IPacketSpliter endMarkSpliter = new EndMarkPacketSpliter(false, (byte)'\x04');

            //5.packet that do not need to be split
            IPacketSpliter rawSpliter = RawPacketSpliter.Default;

            //6.custom packet spliter
            IPacketSpliter customSpliter = new CustomPacketSpliter();

            //_tcpServer = new TcpServer();
            _tcpServer = new TcpServer(simpleSpliter);
            _tcpServer.ClientStatusChanged += OnTcpServer_ClientStatusChanged;
            _tcpServer.MessageReceived     += OnTcpServer_MessageReceived;

            ServerSendText = "I am server";
        }
Beispiel #3
0
 protected PipeBase()
 {
     _packetSpliter = new SimplePacketSpliter();
     _recvQueue     = new RingQueue();
     if (SynchronizationContext.Current != null)
     {
         _syncContext = SynchronizationContext.Current;
     }
     else
     {
         _syncContext = new SynchronizationContext();
         SynchronizationContext.SetSynchronizationContext(_syncContext);
     }
 }