当前位置: 首页>>代码示例>>C#>>正文


C# IConnection.BeginReceive方法代码示例

本文整理汇总了C#中IConnection.BeginReceive方法的典型用法代码示例。如果您正苦于以下问题:C# IConnection.BeginReceive方法的具体用法?C# IConnection.BeginReceive怎么用?C# IConnection.BeginReceive使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在IConnection的用法示例。


在下文中一共展示了IConnection.BeginReceive方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: BindEvents

 /// <summary>
 /// Binds the events for any incoming TCP activity
 /// </summary>
 protected void BindEvents(IConnection underlyingConnection)
 {
     underlyingConnection.OnConnection += OnConnect;
     underlyingConnection.OnDisconnection += OnDisconnect;
     underlyingConnection.OnError += OnException;
     underlyingConnection.BeginReceive(OnMessage);
 }
开发者ID:njannink,项目名称:sonarlint-vs,代码行数:10,代码来源:HeliosHelpers.cs

示例2: OnConnected

        public void OnConnected(IConnection connection)
        {
            Console.WriteLine("connected from:" + connection.RemoteEndPoint.ToString());

            //开始接收数据,没有这个操作将不接受该连接发送的数据
            connection.BeginReceive();
        }
开发者ID:zhujunxxxxx,项目名称:FastNetwork,代码行数:7,代码来源:ServerHandler.cs

示例3: ConnectionEstablishedCallback

 private void ConnectionEstablishedCallback(INode remoteAddress, IConnection responseChannel)
 {
     Invoke((Action) (() =>
     {
         AppendStatusText(string.Format("Connected to {0}", remoteAddress));
         responseChannel.BeginReceive();
         tsStatusLabel.Text = string.Format("Connected to {0}", remoteAddress);
         btnConnect.Enabled = false;
         btnDisconnect.Enabled = true;
         btnSend.Enabled = true;
         tbSend.Enabled = true;
     }));
 }
开发者ID:KeithLee208,项目名称:helios,代码行数:13,代码来源:SocketClient.cs

示例4: Listen

        public override Task<Tuple<Address, TaskCompletionSource<IAssociationEventListener>>> Listen()
        {
            var listenAddress = NodeBuilder.BuildNode().Host(Settings.Hostname).WithPort(Settings.Port);
            var publicAddress = NodeBuilder.BuildNode().Host(Settings.PublicHostname).WithPort(Settings.Port);
            var newServerChannel = NewServer(listenAddress);
            newServerChannel.Open();
            publicAddress.Port = newServerChannel.Local.Port; //use the port assigned by the transport

            //Block reads until a handler actor is registered
            //TODO
            ConnectionGroup.TryAdd(newServerChannel);
            ServerChannel = newServerChannel;

            var addr = NodeToAddress(publicAddress, SchemeIdentifier, System.Name, Settings.PublicHostname);
            if(addr == null) throw new HeliosNodeException("Unknown local address type {0}", newServerChannel.Local);
            LocalAddress = addr;
            AssociationListenerPromise.Task.ContinueWith(result => ServerChannel.BeginReceive(), TaskContinuationOptions.ExecuteSynchronously);

            return Task.Run(() => Tuple.Create(addr, AssociationListenerPromise));
        }
开发者ID:njimenez,项目名称:akka.net,代码行数:20,代码来源:HeliosTransport.cs

示例5: ConnectionEstablishedCallback

 private void ConnectionEstablishedCallback(INode remoteAddress, IConnection responseChannel)
 {
     responseChannel.BeginReceive();
     //Invoke((Action)(() =>
     //{
     //    AppendStatusText(string.Format("Connected to {0}", remoteAddress));
     //    responseChannel.BeginReceive();
     //    tsStatusLabel.Text = string.Format("Connected to {0}", remoteAddress);
     //    btnSend.Enabled = true;
     //    tbSend.Enabled = true;
     //}));
 }
开发者ID:erynet,项目名称:SensorMonitor,代码行数:12,代码来源:Entry.cs

示例6: OnConnect

 protected override void OnConnect(INode remoteAddress, IConnection responseChannel)
 {
     //Got to pass OnMessage here or get null reference.
     responseChannel.BeginReceive(OnMessage);
     _handler.OnConnect(remoteAddress, responseChannel);
 }
开发者ID:njannink,项目名称:sonarlint-vs,代码行数:6,代码来源:RemoteConnection.cs

示例7: OnConnected

        /// <summary>
        /// OnConnected
        /// </summary>
        /// <param name="connection"></param>
        protected override void OnConnected(IConnection connection)
        {
            base.OnConnected(connection);

            this._currentConnection = connection;
            connection.BeginReceive();

            string[] channels = null;
            string[] patterns = null;
            lock (this)
            {
                if (this._setChannels.Count > 0)
                {
                    channels = new string[this._setChannels.Count];
                    this._setChannels.CopyTo(channels);
                }

                if (this._setPatterns.Count > 0)
                {
                    patterns = new string[this._setPatterns.Count];
                    this._setPatterns.CopyTo(patterns);
                }
            }
            this.SubscribeInternal(channels);
            this.PatternSubscribeInternal(patterns);
        }
开发者ID:dut3062796s,项目名称:Redis.Driver.Net,代码行数:30,代码来源:RedisSubscriber.cs

示例8: OnConnected

 /// <summary>
 /// OnConnected
 /// </summary>
 /// <param name="connection"></param>
 protected override void OnConnected(IConnection connection)
 {
     autoEvent.Set();
     connection.BeginReceive();//异步开始接收数据
     //触发事件
     try { this._handler.OnConnected(connection); }
     catch (Exception ex) { Log.Trace.Error(ex.Message, ex); }
 }
开发者ID:zhujunxxxxx,项目名称:FastNetwork,代码行数:12,代码来源:BaseSocketClient.cs


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