本文整理汇总了C#中ITransport.WriteByte方法的典型用法代码示例。如果您正苦于以下问题:C# ITransport.WriteByte方法的具体用法?C# ITransport.WriteByte怎么用?C# ITransport.WriteByte使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ITransport
的用法示例。
在下文中一共展示了ITransport.WriteByte方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: WriteHeader
public HeaderParams WriteHeader(ITransport trans, HeaderParams param, byte ver)
{
trans.WriteByte(HotRodConstants.REQUEST_MAGIC);
//TODO: Implement a proper way to increment message ID
Random r = new Random();
StringBuilder sb = new StringBuilder();
param.MessageId(r.Next(0, 255));
trans.WriteVLong(param.Messageid); //message id
trans.WriteByte(HotRodConstants.VERSION_11);//version
trans.WriteByte(param.OperCode);//opcode
if (param.Cachename.Length != 0)
{
trans.WriteArray(param.Cachename); // Cache name is not used for default cache
}
else
{
trans.WriteVInt(param.Cachename.Length);//default cache name. therefore cache name length is 0
}
int flagInt = 0x00; //0x00 Used here since intention is to use no flags
if (param.Flag != null)
{
foreach (Flag f in param.Flag)
{
flagInt = f.GetFlagInt() | flagInt;
}
}
trans.WriteVInt(flagInt);//flag is 0 for base clients
trans.WriteByte(param.Clientintel);
trans.WriteVInt(cacheManager.GetTopologyId());//for basic clients topology ID = 0
if (logger.IsTraceEnabled)
logger.Trace("topologyID Sent = " + param.Topologyid);
trans.WriteByte(param.Txmarker);
return param;
}