Originally Posted By: DeSync
This is my file receive script:

Code:
on *:SOCKREAD:download_*: {
  if $sockerr > 0 {
    echo -s error
  }
  else {
    var %read
    if !$sock($sockname).mark {
      sockread %read
      if %read != $null {
        sockmark $sockname 1
      }
    }
    else {
      sockread %read
      if download_* iswm $sockname {
        while ($sock($sockname).rq > 0) {
          sockread &file_d
          .bwrite $qt($mircdir $+ $remove($sockname, download_)) -1 -1 &file_d
        }
      }
    }
  }
}


Now just with
Code:
sockread -f &file_d


This is additional:

Code:
alias download_file {
  if $sock($1) {
    sockclose $1
  }
  sockopen $+(download_, $1) HOST-HERE 80
}
on *:SOCKOPEN:download_*: {
  if $sockerr > 0 {
    echo -s Error.
  }
  else {
    sockwrite -n $sockname GET $+(/files/, $remove($sockname, download_)) HTTP/1.0
    sockwrite -n $sockname Connection: Keep-Alive
    sockwrite -n $sockname Host: HOST
    sockwrite -n $sockname $crlf $crlf
  }
}


Last edited by DeSync; 26/12/10 06:18 PM.