Here's an example:

I've uploaded a picture on the url: http://www.student.kuleuven.ac.be/~m0120111/Dieter/test1.jpg

This is the code to download it.

Code:
alias gpic {
  if $sock(gpic) { echo -ac info * Still downloading, hold on | return }
  write -c pic.jpg
  sockopen gpic student.kuleuven.ac.be 80
}

on *:sockopen:gpic:{
  if $sockerr { echo -ac info * Error opening socket | return }
  var %s = sockwrite -n gpic
  %s GET /~m0120111/Dieter/test1.jpg HTTP/1.0
  %s Host: student.kuleuven.ac.be $str($crlf,2)
}

on *:sockread:gpic:{
  if $sockerr { return }
  if !$sock(gpic).mark {
    var %a
    sockread %a
    if %a == $null { sockmark gpic 1 }
  }
  else {
    sockread &a
    while $sockbr {
      bwrite pic.jpg -1 -1 &a
      sockread &a
    }
  }
}

on *:sockclose:gpic:{
  echo -ac info * Finished downloading pic
  run pic.jpg
}

Last edited by FiberOPtics; 19/04/05 12:53 AM.

Gone.