ô > HTTPServer &ô Deliver a webpage using the HTTP ô (C)2010 SPROW (0ô Modified by JGH to use BBC Sockets Library 2: 0 Œ òdorequest(httpreq%,ipaddrblk!4):òskt_close(httpreq%):httpreq%=-1 þý0 :  Ýòdorequest(socket%,remote%)  êsize% &4size%=¤skt_recv(socket%,httprecvblk,httpsize%,0) 0.çsize%<=0 Œ á:ô Stream closed unexpectedly :.httprecvblk?size%=13:ô Ensure a terminator D"çÀ$httprecvblk,5)<>"GET /" Œ á N7ñ¤IP_Stn(remote%);" sent '"À$httprecvblk,16);"...'" X=ô There are no sub pages, any 'GET' will return this HTML bT$httpsendblk="HTTP/1.1 200 OK"+½13+½10+"Content-type: text/html"+½13+½10+½13+½10 lIç¤skt_send(socket%,httpsendblk,44,0)<=0 Œ ñ"Failed to deliver header" v`$httpsendblk="Test PageTime is "+Ñ+"" €Rç¤skt_send(socket%,httpsendblk,©$httpsendblk,0)<=0 Œ ñ"Failed to deliver page" Šá ”: ž: ¨ô > BLib.IP 1.00 12Feb2009 ²: ¼0ô IP_Stn - Returns dotted net&station number Æ0ô ------------------------------------------ Ð*ݤIP_Stn(A%):ê B%:Þ B%-1:!B%=A%:B%!4=0 Ú'=ÃB%?3+"."+ÃB%?2+"."+ÃB%?1+"."+Ã?B% ä: îBô IP_StnFixed - Returns fixed-length dotted net&station number øFô ---------------------------------------------------------------- (ݤIP_StnFixed(A%):ê B%:Þ B%-1:!B%=A%  ?=¤d0(B%?3,3)+"."+¤d0(B%?2,3)+"."+¤d0(B%?1,3)+"."+¤d0(?B%,3) :  >ô IP_StnNum - Convert dotted IP address string into number *>ô -------------------------------------------------------- 42ݤIP_StnNum(A$):ê B%:Þ B%-1:!B%=0:õ!B%=!B%+»A$ >/A%=§A$,"."):çA%:A$=ÁA$,A%+1):B%!1=!B%:?B%=0 HýA%=0:=!B% R: \/ô swap_16 - Swap b0-b7 and b8-b15 of number f1ô ------------------------------------------- pݤswap_16(A%) z,ê B%:Þ B%-1:!B%=A%:B%!2=A%:=(B%!1)€&FFFF „: Ž0ô swap_32 - word from &AABBCCDD to &DDCCBBAA ˜2ô -------------------------------------------- ¢ݤswap_32(A%) ¬9ê B%:Þ B%-1:!B%=A%:B%?4=B%?2:B%?5=B%?1:B%?6=?B%:=B%!3 ¶: À#ݤd0(A%,N%)=Â"00000000"+ÃA%,N%) Ê: Ô: Þ$ô > BLib.Socket 1.00 12-Dec-2010 èô Sockets Library ò5ô Requires X%->32-byte control block, Y%=X%DIV256 ü+ô FNIP_gethost requires name%->80 bytes : ô FNIP_gethost(name$) ô ------------------- $TݤIP_gethost(A$):!X%=&411808:X%!4=name%:$name%=A$:A%=192:Ö&FFF1:çX%?3:=0 ‹ =X%+4 .: 8!ô FNskt_open(pf%,type%,prot%) B"ô ---------------------------- LHݤskt_open(X%!4,X%!8,X%!12):!X%=&810:A%=192:Ö&FFF1:çX%?3:=-1 ‹ =X%!4 V: `(ô FNskt_bind(handle%,addr%,addrlen%) j(ô ---------------------------------- tJݤskt_bind(X%!4,X%!8,X%!12):!X%=&10810:A%=192:Ö&FFF1:çX%?3:=-1 ‹ =X%!4 ~: ˆ"ô FNskt_listen(handle%,count%) ’"ô ---------------------------- œFݤskt_listen(X%!4,X%!8):!X%=&2080C:A%=192:Ö&FFF1:çX%?3:=-1 ‹ =X%!4 ¦: °*ô FNskt_accept(handle%,addr%,addrlen%) º*ô ------------------------------------ ÄLݤskt_accept(X%!4,X%!8,X%!12):!X%=&30816:A%=192:Ö&FFF1:çX%?3:=-1 ‹ =X%!4 Î: Ø+ô FNskt_connect(handle%,addr%,addrlen%) â+ô ------------------------------------- ìMݤskt_connect(X%!4,X%!8,X%!12):!X%=&40816:A%=192:Ö&FFF1:çX%?3:=-1 ‹ =X%!4 ö: *ô FNskt_recv(handle%,data%,len%,opts%)  *ô ------------------------------------ Pݤskt_recv(X%!4,X%!8,X%!12,X%!16):!X%=&50814:A%=192:Ö&FFF1:çX%?3:=-1 ‹ =X%!4 : (*ô FNskt_send(handle%,data%,len%,opts%) 2*ô ------------------------------------