udpnxtp.c
来自「关于UDP方面的东西。。看不懂就算了。不适合基础者。」· C语言 代码 · 共 31 行
C
31 行
/* udpnxtp.c - udpnxtp */#include <conf.h>#include <kernel.h>#include <network.h>/*------------------------------------------------------------------------ * udpnxtp - return the next available UDP local "port" number * N.B.: assumes udpmutex HELD *------------------------------------------------------------------------ */unsigned short udpnxtp(){ static unsigned short lastport = ULPORT; Bool inuse = TRUE; struct upq *pup; int i; while (inuse) { lastport++; if (lastport == 0) lastport = ULPORT; inuse = FALSE; for (i=0; !inuse && i<UPPS ; i++) { pup = &upqs[i]; inuse = pup->up_valid && pup->up_port == lastport; } } return lastport;}
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?