本文整理汇总了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);
}
示例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);
}
}
示例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);
}
示例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));
}
示例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;
}