Sending via Sock, would be SOMETHING like the following, although sending to yourself, may or may not break this code, since the $sock().queue may exceed, but sending to others should work just fine.

The below code is the alias that starts everything, /socksend nickname C:\directory\to\file.exe, note there is NO verification or checking in these, you can add them (if this is what your after) yourself.

What it does is basically send the info needed to start it all off, basically the NOTICE and the MSG line, where the syntax is:

NOTICE nickname DCC Send filename.exe (your.ip.address)

MSG nickname $chr(1) $+ DCC SEND filename.exe $longip(your.ip.address) port filesize $+ $chr(1)

It picks a RANDOM port between 1024 and 5000, again there is no verification to see if hte port is already open ($portfree) it then listens on that port and saves the filename in "sockmark".

In case your wondering, in DCC send, the other person OPENs the socket to you, not vice-a-versa.

alias socksend {
if ($1) {
NOTICE $1 DCC Send $nopath($2-) ( $+ $ip $+ )
var %p = $rand(1024,5000)
MSG $1 $+($chr(1),DCC) SEND $nopath($2-) $longip($ip) %p $+($file($2-),$chr(1))
sockclose $+(tmpsocksend.,%p)
socklisten $+(tmpsocksend.,%p) %p
sockmark $+(tmpsocksend.,%p) $+(",$2-,")
}
}

The following detects the recieving user connecting to you and accepts the socket and begins sending the first few bytes of the file.

On *:Socklisten:tmpsocksend.*:{
sockaccept $remove($sockname,tmp)
sockmark $remove($sockname,tmp) $sock($sockname).mark
echo -s Accepted.
sock.sendfile $remove($sockname,tmp) $sock($sockname).mark
sockclose $sockname
}

The following alias is the alias used to "start" the dcc send, by sending the first 8192 bytes of the file and storing a variable againest the amount in bytes have been sent already.

alias sock.sendfile {
echo -s Starting DCC Send. ( $+ $1 $+ / $+ $2- $+ )
set $+(%,$1) 0
bread $2- $eval($+(%,$1),2) 8192 $+(&,$1)
sockwrite $1 $+(&,$1)
inc $+(%,$1) 8192
}

This triggers AFTER you have /sockwrite'd (everytime you send part of the time), and basically sends the next part.

On *:Sockwrite:socksend.*:{
if ($file($sock($sockname).mark) >= $eval($+(%,$sockname),2)) {
bread $sock($sockname).mark $eval($+(%,$sockname),2) 8192 $+(&,$sockname)
sockwrite $sockname $+(&,$sockname)
inc $+(%,$sockname) 8192
echo -a Sent, $eval($+(%,$sockname),2) Bytes. ( $+ $sockname $+ / $+ $sock($sockname).mark $+ )
}
}

Eamonn.