怎么判断超时??
我用c#写了一个ping程序,可是不知道怎么判断超时,发送完Icmp request包后
int nbyte;
int timestart=0,timecost=0;
timestart=Environment.TickCount;
while(true)
{
Byte[] recvbuf=new Byte[256];
nbyte=myso.ReceiveFrom(recvbuf,256,0,ref reServer);
timecost=Environment.TickCount-timestart;
if(timecost>1000)
Console.WriteLine("Time out");
else
..........
可是程序运行到receiveFrom这句时就阻塞了,不会运行到下面判断超时的哪句,哪位兄弟帮帮忙看看怎么解决