alias getpicture {
%found = 0
%socketwindow100 = @pic
write -c pic.bmp
/sockopen gpic vd.aligno.nl 80
}
on *:sockopen:gpic:{
if $sockerr { echo -ac info * Error opening socket | return }
var %s = sockwrite -n gpic
%s GET /mypic.bmp HTTP/1.0
%s Host: vd.aligno.nl $str($crlf,2)
}
on *:sockread:gpic:{
if $sockerr { return }
if !$sock(gpic).mark {
var %a
sockread %a
if (%a != $null) /echo -s %a
if %a == $null { sockmark gpic 1 }
}
else {
sockread &a
while $sockbr {
bwrite pic.bmp -1 -1 &a
sockread &a
;it doesnt even get here
/echo -s - $bvar(&a).text
}
}
}