;
TN_LOCAL_PORT.MAR get TCPIP port of (telnet) terminal
;Writing this, I get some new idea abbout the local port number.
;It was not a good idea, but after some searching about
;BG devices and so on I found that there are some special qio functions for the telnet driver.
;So there is a program. Itis ougly writen and returns the port in $STATUS !!!
$iodef
TN$_LOCAL_ADDRESS = 11
IO$M_TN_SENSEMODE = 16384
.psect data,noexe,wrt
tt: .ascid /TT/
chan: .blkw
ret: .blkb 32
itml: .word 32
.word TN$_LOCAL_ADDRESS
.address ret
.long 0
port: .ascid / /
portsym: .ascid /PORT/
bport: .blkw
.psect code exe,nowrt
.entry a ^M<>
$assign_s devnam = tt , chan=chan
blbc r0,err
movab itml , r1
$qiow_s chan=chan,func=#IO$_TTY_PORT_BUFIO!IO$M_TN_SENSEMODE,p5=r1
blbc r0,err
movb ret+3 , bport
movb ret+2 , bport+1
pushl #2
pushl #1
pushaq port
pushaw bport
calls #4,g^ots$cvt_l_tu
blbc r0,end
pushaq port
pushaq portsym
calls #2,g^lib$set_symbol
err:
ret
.end a