本文整理汇总了C#中Tamir.SharpSsh.jsch.Packet.unshift方法的典型用法代码示例。如果您正苦于以下问题:C# Packet.unshift方法的具体用法?C# Packet.unshift怎么用?C# Packet.unshift使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Tamir.SharpSsh.jsch.Packet
的用法示例。
在下文中一共展示了Packet.unshift方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: write
public void write(Packet packet, Channel c, int length)
{
while(true)
{
if(in_kex)
{
try{Thread.Sleep(10);}
catch(ThreadInterruptedException e){};
continue;
}
lock(c)
{
if(c.rwsize>=length)
{
c.rwsize-=length;
break;
}
}
if(c._close || !c.isConnected())
{
throw new IOException("channel is broken");
}
bool sendit=false;
int s=0;
byte command=0;
int recipient=-1;
lock(c)
{
if(c.rwsize>0)
{
int len=c.rwsize;
if(len>length)
{
len=length;
}
if(len!=length)
{
s=packet.shift(len, (c2smac!=null ? c2smac.getBlockSize() : 0));
}
command=packet.buffer.buffer[5];
recipient=c.getRecipient();
length-=len;
c.rwsize-=len;
sendit=true;
}
}
if(sendit)
{
_write(packet);
if(length==0)
{
return;
}
packet.unshift(command, recipient, s, length);
lock(c)
{
if(c.rwsize>=length)
{
c.rwsize-=length;
break;
}
}
}
try{Thread.Sleep(100);}
catch(ThreadInterruptedException e){};
}
_write(packet);
}
示例2: write
/*lock*/
public void write(Packet packet, Channel c, int length)
{
while(true)
{
if(c.rwsize>=length)
{
c.rwsize-=length;
break;
}
if(c._close || !IsConnected())
{
throw new IOException("channel is broken");
}
if(c.rwsize>0)
{
int len=c.rwsize;
int s=packet.shift(len, (c2smac!=null ? c2smac.getBlockSize() : 0));
byte command=packet.buffer.buffer[5];
int recipient=c.getRecipient();
length-=len;
c.rwsize=0;
write(packet);
packet.unshift(command, recipient, s, length);
}
try{System.Threading.Thread.Sleep(10);}
catch{};
}
write(packet);
}