• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

C# IProtocol类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C#中IProtocol的典型用法代码示例。如果您正苦于以下问题:C# IProtocol类的具体用法?C# IProtocol怎么用?C# IProtocol使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



IProtocol类属于命名空间,在下文中一共展示了IProtocol类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。

示例1: OpenConnection

        private IConnection OpenConnection(RabbitMQUri uri, IProtocol protocol)
        {
            int port = uri.Port.HasValue ? uri.Port.Value : protocol.DefaultPort;

            ConnectionFactory connFactory = new ConnectionFactory
                {
                    AutomaticRecoveryEnabled = true,
                    HostName = uri.Host,
                    Port = port,
                    Protocol = protocol
                };

            if (uri.Username != null)
            {
                connFactory.UserName = uri.Username;
            }
            if (uri.Password != null)
            {
                connFactory.Password = uri.Password;
            }
            if (uri.VirtualHost != null)
            {
                connFactory.VirtualHost = uri.VirtualHost;
            }

            return connFactory.CreateConnection();
        }
开发者ID:ronybot,项目名称:MessageBus,代码行数:27,代码来源:ConnectionManager.cs


示例2: ServerCommData

 public ServerCommData(
     IProtocol protocol, 
     ByteArrayReader incomingData = null)
     : base(protocol)
 {
     IncomingData = incomingData;
 }
开发者ID:gbcwbz,项目名称:ModbusTool,代码行数:7,代码来源:ServerCommData.cs


示例3: SerialPortServer

 public SerialPortServer(
     SerialPort port,
     IProtocol protocol)
 {
     Port = port;
     Protocol = protocol;
 }
开发者ID:gbcwbz,项目名称:ModbusTool,代码行数:7,代码来源:SerialPortServer.cs


示例4: RecieveThread

 /// <summary>
 /// Creates a RecieveThread to recieve messages on the specified protocol
 /// </summary>
 /// <param name="protocol">The protocol to recieve messages from</param>
 /// <param name="server">The server to recieve for</param>
 public RecieveThread(IProtocol protocol, INovaServer server)
 {
     protocols.Add(protocol);
     this.server = server;
     thread = new Thread(RecieveLoop);
     log = LogManager.GetLogger(typeof(RecieveThread));
 }
开发者ID:BackupTheBerlios,项目名称:nova-svn,代码行数:12,代码来源:RecieveThread.cs


示例5: GetConnectionFactory

        private ConnectionFactory GetConnectionFactory(IProtocol protocol, RabbitMqAddress brokerAddress)
        {
            ConnectionFactory factory = null;
            var key = string.Format("{0}:{1}", protocol, brokerAddress);

            if(!connectionFactories.TryGetValue(key, out factory))
            {
                factory = new ConnectionFactory();
                factory.Endpoint = new AmqpTcpEndpoint(protocol, brokerAddress.Broker);

                if(!string.IsNullOrEmpty(brokerAddress.VirtualHost))
                    factory.VirtualHost = brokerAddress.VirtualHost;

                if(!string.IsNullOrEmpty(brokerAddress.Username))
                    factory.UserName = brokerAddress.Username;

                if(!string.IsNullOrEmpty(brokerAddress.Password))
                    factory.Password = brokerAddress.Password;

                factory = connectionFactories.GetOrAdd(key, factory);
                log.Debug("Opening new Connection Factory " + brokerAddress + " using " + protocol.ApiName);
            }

            return factory;
        }
开发者ID:writeameer,项目名称:nservicebus-rabbitmq,代码行数:25,代码来源:ConnectionProvider.cs


示例6: HandleEvent

 public void HandleEvent(IProtocol protocol, IEvent e)
 {
     EventId eid = (EventId)e.ID;
     switch (eid)
     {
         case EventId.Disconnect:
             Stop();
             break;
         case EventId.SendMessage:
             if (!protocol.isClosed())
             {
                 if (transport != null)
                 {
                     transport.Send(e.Data);
                 }
             }
             break;
         case EventId.Media:
             Console.WriteLine("media event received, id={0}", eid);
             break;
         case EventId.Content:
             break;
         case EventId.Stack:
             break;
         case EventId.Schedule:
             break;
     }
 }
开发者ID:anjing,项目名称:TCPChannel,代码行数:28,代码来源:TcpHost.cs


示例7: TcpServer

        /// <summary>
        /// Initializes a new instance of the <see cref="TcpServer"/> class.
        /// </summary>
        /// <remarks>If the port number is in range of the well-known ports [0 - 1024] the default port 80 is taken.</remarks>
        /// <param name="service">The TCP Service implementation which can handle the incoming requests.</param>
        /// <param name="portNumber">The port where this server should listen on incoming connections. Must be > 1023.</param>
        /// <exception cref="PlatformNotSupportedException">Is thrown when the underlying operating system does not support <see cref="HttpListener"/>s.</exception>
        /// <exception cref="ArgumentNullException">Is thrown when <paramref name="service"/> is a null reference.</exception>
        /// <exception cref="ArgumentException">Is thrown when <paramref name="portNumber"/> is bigger than 65535.</exception>
        public TcpServer(IProtocol service, int portNumber)
        {
            if (service == null)
            {
                throw new ArgumentNullException("service", "The Service endpoint must be an instance.");
            }

            if (portNumber > TcpServer.BiggestPossiblePortNumber)
            {
                throw new ArgumentException("The port number must be smaller than " + (TcpServer.BiggestPossiblePortNumber + 1) + ".", "portNumber");
            }

            if (portNumber < TcpServer.SmallestPossiblePortNumber)
            {
                _logger.WarnFormat("Using default port number {0} to listen on TCP requests.", portNumber);
                this.ListeningPort = DefaultPortNumber;
            }

            var localAddress = IPAddress.Parse("127.0.0.1");
            _tcpListener = new TcpListener(localAddress, portNumber);
            _serviceEndpoint = service;
            _logger.DebugFormat(CultureInfo.CurrentCulture, "TCP Listener created on port: " + portNumber);

            this._signals[ExitThread] = this._stopThreadEvent;
            this._signals[LookForNextConnection] = this._listenForConnection;
        }
开发者ID:mark-richardson,项目名称:tomscodeheap,代码行数:35,代码来源:TcpServer.cs


示例8: Peer

 /// <summary>Initializes a new instance of the Peer class using the specified socket and protocol.</summary>
 /// <param name="socket">Socket.</param>
 /// <param name="protocol">Protocol.</param>
 internal Peer(Socket socket, IProtocol protocol)
 {
     _socket = socket;
     _protocol = protocol;
     _socket.ConnectionStateChanged += OnSocketConnectionStateChanged;
     _socket.DataReceived += OnSocketDataReceived;
 }
开发者ID:brainster-one,项目名称:khrussk,代码行数:10,代码来源:Peer.cs


示例9: AmqpTcpEndpoint

 ///<summary>Construct an AmqpTcpEndpoint with the given
 ///IProtocol, hostname, port number and ssl option. If the port 
 ///number is -1, the default port number for the IProtocol 
 ///will be used.</summary>
 public AmqpTcpEndpoint(IProtocol protocol, string hostName, int portOrMinusOne, SslOption ssl)
 {
     m_protocol = protocol;
     m_hostName = hostName;
     m_port = portOrMinusOne;
     m_ssl = ssl;
 }
开发者ID:parshim,项目名称:rabbitmq-dotnet-client,代码行数:11,代码来源:AmqpTcpEndpoint.cs


示例10: StreamConnection

 internal StreamConnection(IReactor dispatcher, IProtocol protocol, TcpClient tcpClient, int bufferSize)
     : base(dispatcher, protocol)
 {
     _tcpClient = tcpClient;
     _readBuffer = new Byte[bufferSize];
     _remoteEndPoint = _tcpClient.Client.RemoteEndPoint as IPEndPoint;
 }
开发者ID:krishnarajv,项目名称:Code,代码行数:7,代码来源:StreamConnection.cs


示例11: MainForm

        /// <summary>
        /// Конструктор класса
        /// </summary>
        /// <param name="app">Ссылка на платформу</param>
        /// <param name="pBios">Ссылка на подсистему ввода/вывода платформы</param>
        public MainForm(IApplication app, IEpromIO pBios, IProtocol protocol)
        {
            InitializeComponent();
            textInserter = new TextInsert(InsertToText);

            oldValue = new object();
            newValue = new object();

            oldValue = "0";
            newValue = "0";

            bios = new BIOS(app, pBios);
            proto = protocol;

            currentState = new ObjectCurrentState();

            for (int i = 0; i < 11; i++)
            {
                DataGridViewRow r = new DataGridViewRow();
                if ((i % 2) == 0) r.DefaultCellStyle.BackColor = Color.WhiteSmoke;
                dataGridViewCalibrationTable.Rows.Add(r);
            }

            syncker = new Sync();
            packetSyncMutex = new Mutex(false);

            gr = new GraphicCalibration(CreateGraphics(), new Rectangle(12, 38, 422, 267));
            gr.CalculateScale();
        }
开发者ID:slawer,项目名称:service,代码行数:34,代码来源:MainForm.cs


示例12: GetConnection

        private IConnection GetConnection(IProtocol protocol, RabbitMqAddress brokerAddress, ConnectionFactory factory)
        {
            IConnection connection = null;
            var key = string.Format("{0}:{1}", protocol, brokerAddress);

            if (!connections.TryGetValue(key, out connection))
            {
                var newConnection = factory.CreateConnection();
                connection = connections.GetOrAdd(key, newConnection);

                //if someone else beat us from another thread kill the connection just created
                if(newConnection.Equals(connection) == false)
                {
                    newConnection.Dispose();
                }
                else
                {
                    log.DebugFormat("Opening new Connection {0} on {1} using {2}",
                                    connection, brokerAddress, protocol.ApiName);
                }

            }

            return connection;
        }
开发者ID:writeameer,项目名称:nservicebus-rabbitmq,代码行数:25,代码来源:ConnectionProvider.cs


示例13: RedirectException

 ///<summary>Uses AmqpTcpEndpoint.Parse and .ParseMultiple to
 ///convert the strings, and then passes them to the other
 ///overload of the constructor.</summary>
 public RedirectException(IProtocol protocol,
                          string host,
                          string knownHosts)
     : this(ParseHost(protocol, host),
            AmqpTcpEndpoint.ParseMultiple(protocol, knownHosts))
 {
 }
开发者ID:parshim,项目名称:rabbitmq-dotnet-client,代码行数:10,代码来源:RedirectException.cs


示例14: MetaverseSession

        public MetaverseSession(IProtocol protocol)
        {
            m_protocol = protocol;

            m_protocol.OnConnected += OnConnected;
            m_protocol.OnLandPatch += OnLandPatch;
            m_protocol.OnChat += ModelChat;
        }
开发者ID:jimmygkr,项目名称:openviewer,代码行数:8,代码来源:MetaverseSession.cs


示例15: GetUdpListener

 /// <summary>
 /// Return a concrete implementation of a UDP listener
 /// </summary>
 /// <param name="port"></param>
 /// <param name="protocol"></param>
 /// <returns></returns>
 public static ICommServer GetUdpListener(
     this Socket port,
     IProtocol protocol)
 {
     return new UdpServer(
         port,
         protocol);
 }
开发者ID:gbcwbz,项目名称:ModbusTool,代码行数:14,代码来源:SocketExtensions.cs


示例16: IndicatorReaderWorker

 public IndicatorReaderWorker(IProtocol protocol, BlockingCollection<float[]> output, TimeSpan timeout)
 {
     _protocol = protocol;
     _output = output;
     _timeout = timeout;
     _timer = new Timer {AutoReset = true, Enabled = false, Interval = timeout.TotalMilliseconds};
     _timer.Elapsed += TimerOnElapsed;
 }
开发者ID:Shinbuev,项目名称:Orthopedy,代码行数:8,代码来源:IndicatorReaderWorker.cs


示例17: TargetViewModel

        /// <summary>
        /// Constructor</summary>
        /// <param name="target">The ITarget whose information will be displayed</param>
        /// <param name="protocol">The target's protocol</param>
        public TargetViewModel(ITarget target, IProtocol protocol)
        {
            Requires.NotNull(target, "target");
            Requires.NotNull(protocol, "protocol");

            Target = target;
            m_protocol = protocol;
        }
开发者ID:Joxx0r,项目名称:ATF,代码行数:12,代码来源:Target.cs


示例18: Engine

 /// <summary>
 /// 
 /// </summary>
 /// <param name="board"></param>
 /// <param name="protocol">Protocol will be used to write output of bestline</param>
 public Engine(Board board, IProtocol protocol)
 {
     Exit = false;
     Board = board;
     Protocol = protocol;
     elapsedTime = new Stopwatch();
     historyMoves = new HistoryMoves();
     killerMoves = new KillerMoves();
 }
开发者ID:BiZonZon,项目名称:a-team-connect4,代码行数:14,代码来源:Engine.cs


示例19: can_evaluate_4

 public void can_evaluate_4()
 {
     auftrag = new Auftrag(new Systemschein( new Systemfeld( 1, 2, 3, 4, 7, 8, 9) { SID = 7 }));
     protocol = auftrag.Tipps[0].evaluate(ausspielung);
     Assert.That(protocol.Hits[6], Is.EqualTo(3));
     Assert.That(protocol.Hits[8], Is.EqualTo(4));
 }
开发者ID:bjornebjornson,项目名称:LottoNh2,代码行数:7,代码来源:_Tipp7_Evaluation.cs


示例20: can_evaluate_6_ZZ

 public void can_evaluate_6_ZZ()
 {
     // ausspielung =: Superzahl == 0 !!!
     auftrag = new Auftrag(new Normalschein( new Normalfeld( 1, 2, 3, 4, 5, 6)) { Losnummer = "0000000" });
     protocol = auftrag.Tipps[0].evaluate(ausspielung);
     Assert.That(protocol.Hits[1], Is.EqualTo(1));
 }
开发者ID:bjornebjornson,项目名称:LottoNh2,代码行数:7,代码来源:_Tipp_Evaluation.cs



注:本文中的IProtocol类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C# IProtocolMessage类代码示例发布时间:2022-05-24
下一篇:
C# IProtoSerializer类代码示例发布时间:2022-05-24
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap