예제 #1
0
        private void createReaderWriter(
            IncomingMessageDispatchCallback incomingMessageDispatchCallback)
        {
            channelWriter = new ChannelWriter(
                connection, target, logCallback, logLevel);

            channelReader =
                new ChannelReader(
                    connection, incomingMessageDispatchCallback,
                    target, options, logCallback, logLevel);
        }
예제 #2
0
        private void connect(
            IncomingMessageDispatchCallback incomingMessageDispatchCallback)
        {
            if (NetworkUtils.protocolIsTcp(target))
            {
                connection = NetworkUtils.connectTcp(target, options);
            }
            else if (NetworkUtils.protocolIsUdp(target))
            {
                connection = NetworkUtils.createUdp(target, options);
            }
            else if (target.Equals("null"))
            {
            // do nothing - this protocol is used for testing only
                channelWriter = new ChannelWriter(
                    null, null, null, LogEventArgs.LogLevel.LOW);
            }
            else
            {
                throw new BadProtocolException(target);
            }

            createReaderWriter(incomingMessageDispatchCallback);
        }