home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Amiga Format CD 28
/
amigaformatcd28.iso
/
-seriously_amiga-
/
comms
/
other
/
rxsocket
/
examples
/
hserv
/
main
/
authfun.rexx
next >
Wrap
OS/2 REXX Batch file
|
1998-05-09
|
747b
|
39 lines
/* */
parse arg ha, lp, sp
say ha lp sp
sin.addrFamily = "INET"
sin.addrAddr = ha
if GetServByName("SE","auth","tcp")<0 then sin.addrPort = se.servPort
else sin.addrPort = 113
say sin.addrFamily sin.addrAddr sin.addrPort
sock = socket("INET","STREAM",0)
if sock<0 then exit "-ERR" errno()
if connect(sock,"SIN")<0 then exit "-ERR" errno()
request = sp "," lp || d2c(13) || d2c(10)
res = send(sock,request)
if res ~= length(request) then exit "-ERR" errno()
ans=""
len = recv(sock,"BUF",1)
do while len>0
ans = ans || buf
len = recv(sock,"BUF",256)
end
if len<0 then exit "-ERR" errno()
call CloseSocket(sock)
if index(ans,"ERROR")~=0 then do
parse var ans "ERROR:" rest
exit "+OK unknown"
end
exit "+OK " || left(ans,length(ans)-1)