本文整理匯總了C#中Tamir.SharpSsh.jsch.Packet.shift方法的典型用法代碼示例。如果您正苦於以下問題:C# Packet.shift方法的具體用法?C# Packet.shift怎麽用?C# Packet.shift使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類Tamir.SharpSsh.jsch.Packet
的用法示例。
在下文中一共展示了Packet.shift方法的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);
}