public int creat_multi_udp_pack2(byte[] ip, int dest_port, byte[] buff, int len, int sendtime, int inittime, int delaytime, string magic, Func Func) { int i; lock (multi_udp.udplock) { if ((i = get_free_buff()) < 0) { Console.WriteLine("multi udp buff is full!"); //release_nest_lock(multi_udp.lock ); return(i); } if (magic != null) { multi_udp.send_buff[i].Magic = magic; } multi_udp.send_buff[i].DestIP = ip; multi_udp.send_buff[i].DestPort = dest_port; multi_udp.send_buff[i].MaxSendNum = sendtime; multi_udp.send_buff[i].SendNum = 0; multi_udp.send_buff[i].DelayTime = inittime; multi_udp.send_buff[i].TimeMap = delaytime; multi_udp.send_buff[i].Time_Count = 0; multi_udp.send_buff[i].timeout = 0; ArrayDeal.memcpy(multi_udp.send_buff[i].Buff, buff, len); multi_udp.send_buff[i].nlength = len; multi_udp.send_buff[i].Func = Func; multi_udp.send_buff[i].isValid = 1; } return(i); }
static public int Remoter_get_addr(int i, byte[] addr) { lock (remoterManageLock) { if (remoter[i].isValid > 0) { ArrayDeal.memcpy(addr, remoter[i].Addr, 6); } else { return(-1); } return(i); } }
static public int Remoter_get_ip(int i, byte[] ip) { lock (remoterManageLock) { if (remoter[i].isValid > 0) { ArrayDeal.memcpy(ip, remoter[i].IP, 4); } else { return(-1); } return(i); } }
static public int Remoter_Add(byte[] Addr, byte[] IP, int Audio_Flag, int Video_Flag) { int i; lock (remoterManageLock) { i = Remoter_Search(IP); if (i != -1) { Console.WriteLine("Remoter_Add: In RemoterList\n" + i); return(i); } for (i = 0; i < REMOTEMAX; i++) { if (remoter[i].isValid == 0) { ArrayDeal.memcpy(remoter[i].Addr, Addr, 6); ArrayDeal.memcpy(remoter[i].IP, IP, 4); remoter[i].Audioflag = Audio_Flag; remoter[i].Videoflag = Video_Flag; remoter[i].isValid = 1; count++; if (Audio_Flag == 1) { audio_count++; } if (Video_Flag == 1) { video_count++; } Console.WriteLine("Add:Remotenum = \n" + count); return(i); } } } return(-1); }