udpnxtp.c,v
来自「TCP-IP红宝书源代码」· C,V 代码 · 共 55 行
C,V
55 行
head 1.1;
access;
symbols;
locks
dls:1.1; strict;
comment @ * @;
1.1
date 97.09.21.19.30.32; author dls; state Dist;
branches;
next ;
desc
@@
1.1
log
@pre-3e code
@
text
@/* 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 + -
显示快捷键?