home *** CD-ROM | disk | FTP | other *** search
/ Magazyn Amiga 12 / MA_Cover_12.iso / libs / rxsocket / examples / ps.rexx < prev    next >
Unknown  |  1999-05-24  |  1.8 KB

open in: MacOS 8.1     |     Win98     |     DOS

view JSON data     |     view as text


This file was not able to be converted.
This format is not currently supported by dexvert.

ConfidenceProgramDetectionMatch TypeSupport
100% file data default
100% xdgMime text/x-csrc default (weak)



hex view
+--------+-------------------------+-------------------------+--------+--------+
|00000000| 2f 2a 20 76 65 72 79 20 | 66 61 73 74 20 74 63 70 |/* very |fast tcp|
|00000010| 20 70 6f 72 74 20 73 63 | 61 6e 6e 65 72 20 2a 2f | port sc|anner */|
|00000020| 0a 0a 73 69 67 6e 61 6c | 20 6f 6e 20 62 72 65 61 |..signal| on brea|
|00000030| 6b 5f 63 0a 0a 6c 3d 22 | 72 6d 68 2e 6c 69 62 72 |k_c..l="|rmh.libr|
|00000040| 61 72 79 22 3b 69 66 20 | 7e 73 68 6f 77 28 22 4c |ary";if |~show("L|
|00000050| 22 2c 6c 29 20 74 68 65 | 6e 3b 69 66 20 7e 61 64 |",l) the|n;if ~ad|
|00000060| 64 6c 69 62 28 6c 2c 30 | 2c 2d 33 30 29 20 74 68 |dlib(l,0|,-30) th|
|00000070| 65 6e 20 65 78 69 74 0a | 69 66 20 41 64 64 4c 69 |en exit.|if AddLi|
|00000080| 62 72 61 72 79 28 22 72 | 65 78 78 73 75 70 70 6f |brary("r|exxsuppo|
|00000090| 72 74 2e 6c 69 62 72 61 | 72 79 22 2c 22 72 78 73 |rt.libra|ry","rxs|
|000000a0| 6f 63 6b 65 74 2e 6c 69 | 62 72 61 72 79 22 29 7e |ocket.li|brary")~|
|000000b0| 3d 30 20 74 68 65 6e 20 | 65 78 69 74 0a 0a 69 66 |=0 then |exit..if|
|000000c0| 20 7e 52 4d 48 5f 52 65 | 61 64 41 72 67 73 28 22 | ~RMH_Re|adArgs("|
|000000d0| 48 4f 53 54 2f 41 2c 46 | 52 4f 4d 2f 4e 2c 54 4f |HOST/A,F|ROM/N,TO|
|000000e0| 2f 4e 2c 56 45 52 3d 56 | 45 52 42 4f 53 45 2f 53 |/N,VER=V|ERBOSE/S|
|000000f0| 22 29 20 74 68 65 6e 20 | 64 6f 0a 09 63 61 6c 6c |") then |do..call|
|00000100| 20 50 72 69 6e 74 46 61 | 75 6c 74 28 29 0a 09 65 | PrintFa|ult()..e|
|00000110| 78 69 74 0a 65 6e 64 0a | 0a 69 66 20 70 61 72 6d |xit.end.|.if parm|
|00000120| 2e 31 2e 66 6c 61 67 20 | 74 68 65 6e 20 66 72 6f |.1.flag |then fro|
|00000130| 6d 3d 70 61 72 6d 2e 31 | 2e 76 61 6c 75 65 0a 65 |m=parm.1|.value.e|
|00000140| 6c 73 65 20 66 72 6f 6d | 3d 31 0a 0a 69 66 20 70 |lse from|=1..if p|
|00000150| 61 72 6d 2e 32 2e 66 6c | 61 67 20 74 68 65 6e 20 |arm.2.fl|ag then |
|00000160| 74 6f 3d 70 61 72 6d 2e | 32 2e 76 61 6c 75 65 0a |to=parm.|2.value.|
|00000170| 65 6c 73 65 0a 09 69 66 | 20 70 61 72 6d 2e 31 2e |else..if| parm.1.|
|00000180| 66 6c 61 67 20 74 68 65 | 6e 20 74 6f 3d 66 72 6f |flag the|n to=fro|
|00000190| 6d 0a 09 65 6c 73 65 20 | 74 6f 3d 38 30 0a 69 66 |m..else |to=80.if|
|000001a0| 20 66 72 6f 6d 3c 31 20 | 7c 20 74 6f 3e 36 35 35 | from<1 || to>655|
|000001b0| 33 35 20 7c 20 66 72 6f | 6d 3e 74 6f 20 74 68 65 |35 | fro|m>to the|
|000001c0| 6e 20 64 6f 0a 09 73 61 | 79 20 22 62 61 64 20 70 |n do..sa|y "bad p|
|000001d0| 6f 72 74 73 20 73 65 71 | 75 65 6e 63 65 22 20 66 |orts seq|uence" f|
|000001e0| 72 6f 6d 22 2e 2e 2e 22 | 74 6f 0a 09 65 78 69 74 |rom"..."|to..exit|
|000001f0| 0a 65 6e 64 0a 0a 73 69 | 6e 2e 61 64 64 72 41 64 |.end..si|n.addrAd|
|00000200| 64 72 3d 72 65 73 6f 6c | 76 65 28 70 61 72 6d 2e |dr=resol|ve(parm.|
|00000210| 30 2e 76 61 6c 75 65 29 | 0a 69 66 20 73 69 6e 2e |0.value)|.if sin.|
|00000220| 61 64 64 72 41 64 64 72 | 3d 2d 31 20 74 68 65 6e |addrAddr|=-1 then|
|00000230| 20 64 6f 0a 09 73 61 79 | 20 22 68 6f 73 74 20 3c | do..say| "host <|
|00000240| 22 70 61 72 6d 2e 30 2e | 76 61 6c 75 65 22 3e 20 |"parm.0.|value"> |
|00000250| 6e 6f 74 20 66 6f 75 6e | 64 22 0a 09 65 78 69 74 |not foun|d"..exit|
|00000260| 0a 65 6e 64 0a 0a 73 6d | 3d 32 2a 2a 41 6c 6c 6f |.end..sm|=2**Allo|
|00000270| 63 53 69 67 6e 61 6c 28 | 29 0a 63 61 6c 6c 20 53 |cSignal(|).call S|
|00000280| 65 74 53 6f 63 6b 65 74 | 42 61 73 65 53 69 6e 67 |etSocket|BaseSing|
|00000290| 6c 65 28 22 53 49 47 45 | 56 45 4e 54 4d 41 53 4b |le("SIGE|VENTMASK|
|000002a0| 22 2c 73 6d 29 0a 63 74 | 72 6c 5f 63 3d 32 2a 2a |",sm).ct|rl_c=2**|
|000002b0| 31 32 0a 63 74 72 6c 5f | 64 3d 32 2a 2a 31 33 0a |12.ctrl_|d=2**13.|
|000002c0| 0a 70 70 74 3d 36 34 0a | 74 3d 74 6f 2d 66 72 6f |.ppt=64.|t=to-fro|
|000002d0| 6d 2b 31 0a 6e 3d 74 25 | 70 70 74 0a 69 66 20 28 |m+1.n=t%|ppt.if (|
|000002e0| 74 2f 2f 70 70 74 29 3e | 30 20 74 68 65 6e 20 6e |t//ppt)>|0 then n|
|000002f0| 3d 6e 2b 31 0a 0a 69 66 | 20 70 61 72 6d 2e 33 2e |=n+1..if| parm.3.|
|00000300| 66 6c 61 67 20 74 68 65 | 6e 0a 09 69 66 20 49 73 |flag the|n..if Is|
|00000310| 44 6f 74 41 64 64 72 28 | 70 61 72 6d 2e 30 2e 76 |DotAddr(|parm.0.v|
|00000320| 61 6c 75 65 29 0a 09 09 | 74 68 65 6e 20 73 61 79 |alue)...|then say|
|00000330| 20 22 53 63 61 6e 6e 69 | 6e 67 20 3c 22 70 61 72 | "Scanni|ng <"par|
|00000340| 6d 2e 30 2e 76 61 6c 75 | 65 22 3e 22 20 66 72 6f |m.0.valu|e">" fro|
|00000350| 6d 22 2e 2e 2e 22 74 6f | 20 22 28 22 6e 20 22 63 |m"..."to| "("n "c|
|00000360| 79 63 6c 65 73 29 22 0a | 09 09 65 6c 73 65 20 73 |ycles)".|..else s|
|00000370| 61 79 20 22 53 63 61 6e | 6e 69 6e 67 20 3c 22 70 |ay "Scan|ning <"p|
|00000380| 61 72 6d 2e 30 2e 76 61 | 6c 75 65 22 3e 20 5b 22 |arm.0.va|lue"> ["|
|00000390| 73 69 6e 2e 61 64 64 72 | 41 64 64 72 22 5d 22 20 |sin.addr|Addr"]" |
|000003a0| 66 72 6f 6d 22 2e 2e 2e | 22 74 6f 20 22 28 22 6e |from"...|"to "("n|
|000003b0| 20 22 63 79 63 6c 65 73 | 29 22 0a 0a 64 6f 20 6a | "cycles|)"..do j|
|000003c0| 3d 31 20 74 6f 20 6e 0a | 0a 09 69 66 20 28 66 72 |=1 to n.|..if (fr|
|000003d0| 6f 6d 2b 70 70 74 29 3e | 74 6f 20 74 68 65 6e 20 |om+ppt)>|to then |
|000003e0| 74 3d 74 6f 0a 09 65 6c | 73 65 20 74 3d 66 72 6f |t=to..el|se t=fro|
|000003f0| 6d 2b 70 70 74 2d 31 0a | 09 74 6f 64 6f 3d 74 2d |m+ppt-1.|.todo=t-|
|00000400| 66 72 6f 6d 2b 31 0a 0a | 09 64 6f 20 69 3d 66 72 |from+1..|.do i=fr|
|00000410| 6f 6d 20 74 6f 20 74 0a | 09 09 73 3d 73 6f 63 6b |om to t.|..s=sock|
|00000420| 65 74 28 69 6e 65 74 2c | 73 74 72 65 61 6d 29 0a |et(inet,|stream).|
|00000430| 09 09 63 61 6c 6c 20 53 | 65 74 53 6f 63 6b 4f 70 |..call S|etSockOp|
|00000440| 74 28 73 2c 22 53 4f 43 | 4b 45 54 22 2c 22 45 56 |t(s,"SOC|KET","EV|
|00000450| 45 4e 54 4d 41 53 4b 22 | 2c 22 43 4f 4e 4e 45 43 |ENTMASK"|,"CONNEC|
|00000460| 54 20 45 52 52 4f 52 20 | 52 45 41 44 20 57 52 49 |T ERROR |READ WRI|
|00000470| 54 45 22 29 0a 09 09 70 | 6f 72 74 73 2e 73 3d 69 |TE")...p|orts.s=i|
|00000480| 0a 09 09 73 69 6e 2e 61 | 64 64 72 50 6f 72 74 3d |...sin.a|ddrPort=|
|00000490| 69 0a 09 09 63 61 6c 6c | 20 63 6f 6e 6e 65 63 74 |i...call| connect|
|000004a0| 28 73 2c 22 53 49 4e 22 | 29 0a 0a 09 09 73 72 65 |(s,"SIN"|)....sre|
|000004b0| 63 3d 53 65 74 53 69 67 | 6e 61 6c 28 30 2c 6f 72 |c=SetSig|nal(0,or|
|000004c0| 28 63 74 72 6c 5f 63 2c | 73 6d 29 29 0a 09 09 69 |(ctrl_c,|sm))...i|
|000004d0| 66 20 61 6e 64 28 73 72 | 65 63 2c 63 74 72 6c 5f |f and(sr|ec,ctrl_|
|000004e0| 63 29 3e 30 20 74 68 65 | 6e 20 73 69 67 6e 61 6c |c)>0 the|n signal|
|000004f0| 20 62 72 65 61 6b 5f 63 | 0a 09 09 69 66 20 61 6e | break_c|...if an|
|00000500| 64 28 73 72 65 63 2c 73 | 6d 29 3e 30 20 74 68 65 |d(srec,s|m)>0 the|
|00000510| 6e 20 63 61 6c 6c 20 67 | 65 74 45 76 65 6e 74 0a |n call g|etEvent.|
|00000520| 09 65 6e 64 0a 0a 09 64 | 6f 20 77 68 69 6c 65 20 |.end...d|o while |
|00000530| 74 6f 64 6f 3e 30 0a 09 | 09 69 66 20 61 6e 64 28 |todo>0..|.if and(|
|00000540| 77 61 69 74 28 6f 72 28 | 63 74 72 6c 5f 63 2c 73 |wait(or(|ctrl_c,s|
|00000550| 6d 29 29 2c 63 74 72 6c | 5f 63 29 3e 30 20 74 68 |m)),ctrl|_c)>0 th|
|00000560| 65 6e 20 73 69 67 6e 61 | 6c 20 62 72 65 61 6b 5f |en signa|l break_|
|00000570| 63 0a 09 09 63 61 6c 6c | 20 67 65 74 45 76 65 6e |c...call| getEven|
|00000580| 74 0a 09 65 6e 64 0a 0a | 09 66 72 6f 6d 3d 66 72 |t..end..|.from=fr|
|00000590| 6f 6d 2b 70 70 74 0a 65 | 6e 64 0a 0a 65 78 69 74 |om+ppt.e|nd..exit|
|000005a0| 0a 0a 67 65 74 45 76 65 | 6e 74 3a 0a 09 65 3d 47 |..getEve|nt:..e=G|
|000005b0| 65 74 53 6f 63 6b 65 74 | 45 76 65 6e 74 73 28 22 |etSocket|Events("|
|000005c0| 45 56 45 4e 54 53 22 29 | 0a 09 64 6f 20 77 68 69 |EVENTS")|..do whi|
|000005d0| 6c 65 20 65 3e 3d 30 0a | 09 09 74 6f 64 6f 3d 74 |le e>=0.|..todo=t|
|000005e0| 6f 64 6f 2d 31 0a 09 09 | 69 66 20 65 76 65 6e 74 |odo-1...|if event|
|000005f0| 73 2e 63 6f 6e 6e 65 63 | 74 20 74 68 65 6e 0a 09 |s.connec|t then..|
|00000600| 09 09 69 66 20 70 61 72 | 6d 2e 33 2e 66 6c 61 67 |..if par|m.3.flag|
|00000610| 20 74 68 65 6e 0a 09 09 | 09 09 69 66 20 47 65 74 | then...|..if Get|
|00000620| 53 65 72 76 42 79 50 6f | 72 74 28 22 53 45 52 56 |ServByPo|rt("SERV|
|00000630| 22 2c 70 6f 72 74 73 2e | 65 2c 22 74 63 70 22 29 |",ports.|e,"tcp")|
|00000640| 0a 09 09 09 09 09 74 68 | 65 6e 20 73 61 79 20 73 |......th|en say s|
|00000650| 65 72 76 2e 73 65 72 76 | 4e 61 6d 65 20 22 28 22 |erv.serv|Name "("|
|00000660| 70 6f 72 74 73 2e 65 22 | 29 22 0a 09 09 09 09 09 |ports.e"|)"......|
|00000670| 65 6c 73 65 20 63 61 6c | 6c 20 73 61 79 20 70 6f |else cal|l say po|
|00000680| 72 74 73 2e 65 0a 09 09 | 09 65 6c 73 65 20 73 61 |rts.e...|.else sa|
|00000690| 79 20 70 6f 72 74 73 2e | 65 0a 09 09 63 61 6c 6c |y ports.|e...call|
|000006a0| 20 43 6c 6f 73 65 53 6f | 63 6b 65 74 28 65 29 0a | CloseSo|cket(e).|
|000006b0| 09 09 65 3d 47 65 74 53 | 6f 63 6b 65 74 45 76 65 |..e=GetS|ocketEve|
|000006c0| 6e 74 73 28 22 45 56 45 | 4e 54 53 22 29 0a 09 65 |nts("EVE|NTS")..e|
|000006d0| 6e 64 0a 09 72 65 74 75 | 72 6e 0a 0a 62 72 65 61 |nd..retu|rn..brea|
|000006e0| 6b 5f 63 3a 0a 09 73 61 | 79 20 22 62 72 6f 6b 65 |k_c:..sa|y "broke|
|000006f0| 6e 22 0a 09 65 78 69 74 | 0a a0 0a 2f 2a 00 24 56 |n"..exit|.../*.$V|
|00000700| 45 52 3a 20 70 73 2e 72 | 65 78 78 20 36 2e 30 20 |ER: ps.r|exx 6.0 |
|00000710| 28 31 34 2e 35 2e 39 39 | 29 00 2a 2f 0a |(14.5.99|).*/. |
+--------+-------------------------+-------------------------+--------+--------+