On 8/12/2010 11:14, Raul Miller wrote:
> On Thu, Aug 12, 2010 at 10:54 AM, David Mitchell<[email protected]>
> wrote:
>> How about this (quick and dirty and needs bullet proofing):
>
> I wonder why we do not have a bullet proofed version already.
>
> That said, you are using HTTP 0.9 which is officially an obsolete
> standard. HTTP/1.0 is more complex and HTTP/1.1 is even
> more complex (all in the name of efficiencies are not relevant
> here, but which matter for normal web browsing). And dealing
> with all the little quirks (that sometimes show up in real use)
> takes time and energy (and code).
>
Or this (feel free to expand on this fragment):
require 'socket media/platimg viewmat'
coinsert 'jsocket'
getPent=: 3 : 0
rosettac=. sdcheck sdgethostbyname 'rosettacode.org' NB. find host
skr=. 0 pick sdcheck sdsocket ''
sdcheck sdconnect skr;rosettac,<80 NB. connect to port 80
sdcheck ('GET http://rosettacode.org/mw/images/c/c6/Pentagon.png
HTTP/1.0',CR,LF,'Host: rosettacode.org',CR,LF,CR,LF) sdsend skr,0
qqq=.;sdcheck sdrecv skr,10000,0
qqq=.(4+0{,I.(CR,LF,CR,LF) E. qqq)}.qqq
sdcheck sdclose skr
qqq
)
foo=:getPent''
bitmap=:getimg foo
viewmat bitmap
--
David Mitchell
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm