本文整理汇总了C#中AtomCollection.SetBcstTTL方法的典型用法代码示例。如果您正苦于以下问题:C# AtomCollection.SetBcstTTL方法的具体用法?C# AtomCollection.SetBcstTTL怎么用?C# AtomCollection.SetBcstTTL使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类AtomCollection
的用法示例。
在下文中一共展示了AtomCollection.SetBcstTTL方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: CreateBroadcastPacket
/// <summary>
/// 指定したパケットを含むブロードキャストパケットを作成します
/// </summary>
/// <param name="group">配送先グループ</param>
/// <param name="packet">配送するパケット</param>
/// <returns>作成したPCP_BCSTパケット</returns>
private Atom CreateBroadcastPacket(BroadcastGroup group, Atom packet)
{
var bcst = new AtomCollection();
bcst.SetBcstFrom(PeerCast.SessionID);
bcst.SetBcstGroup(group);
bcst.SetBcstHops(0);
bcst.SetBcstTTL(11);
PCPVersion.SetBcstVersion(bcst);
bcst.SetBcstChannelID(Channel.ChannelID);
bcst.Add(packet);
return new Atom(Atom.PCP_BCST, bcst);
}
示例2: OnPCPBcst
protected void OnPCPBcst(Atom atom)
{
var dest = atom.Children.GetBcstDest();
if (dest==null || dest==PeerCast.SessionID) {
foreach (var c in atom.Children) ProcessAtom(c);
}
var ttl = atom.Children.GetBcstTTL();
var hops = atom.Children.GetBcstHops();
var from = atom.Children.GetBcstFrom();
var group = atom.Children.GetBcstGroup();
if (ttl != null &&
hops != null &&
group != null &&
from != null &&
dest != PeerCast.SessionID &&
ttl>1) {
var bcst = new AtomCollection(atom.Children);
bcst.SetBcstTTL((byte)(ttl - 1));
bcst.SetBcstHops((byte)(hops + 1));
Channel.Broadcast(uphost, new Atom(atom.Name, bcst), group.Value);
}
}
示例3: PostChannelBcst
private void PostChannelBcst(Channel channel, bool playing)
{
var bcst = new AtomCollection();
bcst.SetBcstTTL(1);
bcst.SetBcstHops(0);
bcst.SetBcstFrom(PeerCast.SessionID);
PCPVersion.SetBcstVersion(bcst);
bcst.SetBcstChannelID(channel.ChannelID);
bcst.SetBcstGroup(BroadcastGroup.Root);
PostChannelInfo(bcst, channel);
PostHostInfo(bcst, channel, playing);
lock (posts) posts.Add(new Atom(Atom.PCP_BCST, bcst));
}
示例4: OnPCPBcst
protected virtual void OnPCPBcst(Atom atom)
{
var dest = atom.Children.GetBcstDest();
var ttl = atom.Children.GetBcstTTL();
var hops = atom.Children.GetBcstHops();
var from = atom.Children.GetBcstFrom();
var group = atom.Children.GetBcstGroup();
if (ttl != null &&
hops != null &&
group != null &&
from != null &&
dest != PeerCast.SessionID &&
ttl>0) {
Logger.Debug("Relaying BCST TTL: {0}, Hops: {1}", ttl, hops);
var bcst = new AtomCollection(atom.Children);
bcst.SetBcstTTL((byte)(ttl - 1));
bcst.SetBcstHops((byte)(hops + 1));
Channel.Broadcast(Downhost, new Atom(atom.Name, bcst), group.Value);
}
if (dest==null || dest==PeerCast.SessionID) {
Logger.Debug("Processing BCST({0})", dest==null ? "(null)" : dest.Value.ToString("N"));
foreach (var c in atom.Children) ProcessAtom(c);
}
}
示例5: OnPCPBcst
private void OnPCPBcst(Atom atom)
{
var channel_id = atom.Children.GetBcstChannelID();
if (channel_id!=null) {
Channel channel;
lock (announcingChannels) {
channel = announcingChannels.Find(c => c.Channel.ChannelID==channel_id).Channel;
}
var group = atom.Children.GetBcstGroup();
var from = atom.Children.GetBcstFrom();
var ttl = atom.Children.GetBcstTTL();
var hops = atom.Children.GetBcstHops();
if (channel!=null && group!=null && from!=null && ttl!=null && ttl.Value>0) {
var bcst = new AtomCollection(atom.Children);
bcst.SetBcstTTL((byte)(ttl.Value-1));
bcst.SetBcstHops((byte)((hops ?? 0)+1));
channel.Broadcast(null, new Atom(Atom.PCP_BCST, bcst), group.Value);
}
}
}