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


C# IConnection.SendAsync方法代码示例

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


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

示例1: Write

        public static async Task Write(IConnection connection, IRedisValue value)
        {
            var bytes = value.ToBytes();

            await connection.SendAsync(Encoding.ASCII.GetBytes(DataPrefixes.BytesPrefixAsString + bytes.Length + Delimiter.String));
            await connection.SendAsync(bytes);
            await connection.SendAsync(Delimiter.Bytes);
        }
开发者ID:searbe,项目名称:redis-client,代码行数:8,代码来源:BulkStringWriter.cs

示例2: SendFrame

 public static async Task SendFrame (IConnection connection, Frame frame)
 {
     try {
         await connection.SendAsync (frame.GetBytes ());
     } catch (Exception exception) {
         throw new FrameSendFailedException ("Frame send failed.", exception);
     }
 }
开发者ID:jagrem,项目名称:msg,代码行数:8,代码来源:FrameSender.cs

示例3: Write

        public static async Task Write(IConnection connection, IRedisValue array)
        {
            var arrayValues = array.ToList();

            await connection.SendAsync(Encoding.ASCII.GetBytes(DataPrefixes.ArrayPrefixAsString + arrayValues.Count + Delimiter.String));

            foreach (var redisValue in arrayValues)
                await BulkStringWriter.Write(connection, redisValue);
        }
开发者ID:searbe,项目名称:redis-client,代码行数:9,代码来源:ArrayWriter.cs

示例4: SendInfoMessages

		private void SendInfoMessages (IConnection connection)
		{
			connection.SendAsync (new ServerInfoMessage { ServerInfo = new ServerInfo (context.Settings, context.UserProvider) });
			connection.SendAsync (new ChannelListMessage (this.context.ChannelsProvider.GetChannels(), this.context.ChannelsProvider.DefaultChannel));
			connection.SendAsync (new UserInfoListMessage (Manager));
			connection.SendAsync (new SourceListMessage (this.context.Sources));
		}
开发者ID:ermau,项目名称:Gablarski,代码行数:7,代码来源:ServerUserHandler.cs

示例5: GetJoiningUserInfo

		private IUserInfo GetJoiningUserInfo (IConnection connection, JoinMessage join)
		{
			if (!Manager.GetIsConnected (connection))
			{
				connection.SendAsync (new JoinResultMessage (LoginResultState.FailedNotConnected, null));
				return null;
			}

			IUserInfo info = this.Manager.GetUser (connection);

			if (info == null)
			{
				if (!this.context.Settings.AllowGuestLogins)
				{
					connection.SendAsync (new JoinResultMessage (LoginResultState.FailedUsername, null));
					return null;
				}

				LoginResult r = this.context.UserProvider.Login (join.Nickname, null);
				if (!r.Succeeded)
				{
					connection.SendAsync (new JoinResultMessage (r.ResultState, null));
					return null;
				}

				info = new UserInfo (join.Nickname, join.Phonetic, join.Nickname, r.UserId, this.context.ChannelsProvider.DefaultChannel.ChannelId, false);
			}
			else
				info = new UserInfo (join.Nickname, join.Phonetic, info);

			return info;
		}
开发者ID:ermau,项目名称:Gablarski,代码行数:32,代码来源:ServerUserHandler.cs


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