# dcc.send

Sends a file

Usage

    dcc.send [-s] [-n] [-c] [-u] [-b] [-g[=<file size>]] [-t] [-m[=<boolean>]] [-i=<interface>] [-p=<port>] [-a=<fake address>] [-f=<fake port>] <nickname> [filename]

Description

Attempts to send the file <filename> to <nickname>.
If [filename] is specified it must be an absolute file path, otherwise a file selection dialog is opened.
The simplest case "dcc.send <nickname> <filename>" will work just as in all the other IRC clients, but this command is really more powerful...
Before attempting to understand the possibilities of this command, be sure to know how a dcc negotiation and connection works.
The file will be sent as a sequence of packets which must be acknowledged one by one by the active client.
There is a special option (see $option()) called "fast send" (also known as "send ahead") that makes KVIrc avoid to wait for the acknowledge of the last packet before sending the next one.
Anyway, the connection is declared as successful only when the whole file (all the packets) has been acknowledged.
If you need to send a file but you're firewalled, you might take a look at the dcc.rsend command. It also handles the mIrc zero port protocol extension.

Switches

-g[=<file size>] | --get[=<file size>]

This switch is a dirty trick, you can use it to receive files from people behind a firewall with masquerading enabled.
It causes the transfer direction to be inverted; your client will receive the file from the remote host instead of sending it.
<file size> is the expected file size in bytes. This parameter can be omitted, and in this case the DCC will "blindly" trust the remote end and assume that the file has been transferred correctly when the remote end closes the connection.
If you don't pass the -n option, the remote end will receive an informational DCC RECV request, specifying the IP address and the port to connect to.
-t can be used to prevent sending acknowledges to the remote end, and -u can be used to avoid the listening socket to timeout.
-a and -f can be used as well, but I see no real reason for that...
Here is an example of usage of this option:
spion can't accept connections (is behind a firewall with masquerading or some other reason...), to his machine.
spion wants to send the file important.jpg to Pragma.
spion tells to Pragma that he wants to send him the file and Pragma sets up a connection in the following way:
dcc.send -g spion important.png
spion will see the informational DCC RECV request with the IP address and port that Pragma is listening on. Assume that the address was 212.212.231.220 and the port 32344.
spion will then use the following command:
dcc.send -c -i=212.212.231.220 -p=32344 Pragma /home/spion/important.jpg
Et voila!..the file is transferring.
Pragma will see no file progress indication, since the file size is unknown on Pragma's side.
If spion had specified the file size, Pragma could use -g=<file size> while setting up the connection, to be able to see the progress indications.
If Pragma used the the -n option, the DCC RECV indication wouldn't have been sent, in this case Pragma would need to communicate the Ip address and the port "manually" to spion.

-b | --blind
Assume that no acknowledges are sent. Assume that the transfer was successful when the whole file has been sent, then close the socket. This is called a "blind" DCC send.
-t | -tdcc
Emulate the TDCC protocol: Use the TDCC CTCP message (DCC TSEND) for requesting the connection and assume that no acknowledges are sent. Wait for the remote end to close the connection.
-m[=<boolean>] | --minimize[=<boolean>]
If the -m switch is passed, the default boolCreateMinimizedDccSend option is overridden with the <boolean> parameter passed. So actually by passing -m=1 will create a minimized DCC send even if the $option(boolCreateMinimizedDccSend) returns false. In the same way, by passing -m=0 you will create a non minimized DCC send. If no <boolean> value is specified, it defaults to 1.
-n | --no-ctcp
Do NOT send the CTCP request to the target user, you will have to do it manually, or the remote user will have to connect manually (for example by using dcc.recv -c).
-c | --connect

Attempt to CONNECT to the remote host specified as <interface> and <port>, instead of listening (active connection instead of a passive one). In this case the -i and -p switches are mandatory.
The 'c' switch takes precedence over 'n' (In fact both should be mutually exclusive).
If the 'c' and 'n' switches are missing, this commands needs to be executed in a window that is bound to a connected IRC context (you need a third entity to accomplish the negotiation).

-i=<interface> | --ip=<interface>

Bind the local listening socket to the specified <interface> (which is an IP address, IPv4 or IPv6). If this switch is NOT specified, the socket is bound to the interface of the current IRC connection (if any) or to "127.0.0.1".
You can also specify a local interface name to get the address from (this works only for IPv4 interfaces since IPv6 ones seems to be unsupported by the system ioctl() calls at the moment (for linux at least)).
Here go some examples:
-i=215.243.12.12: this will bind to the IPv4 interface with the specified address.
-i=3ffe:1001::1: this will bind to the IPv6 interface with the specified address.
-i=ppp0: this will bind to the IPv4 address of the interface ppp0 (if supported by the underlying system).
The -i switch parameter may serve also as a target address when the -c switch is used.

-p=<port> | --port=<port>
Bind the local listening socket to the specified <port>. If this switch is NOT specified, the port will be a "random" one chosen by the kernel.
-a=<fake address> | --fake-address=<fake address>
Send the <fake address> as target for the remote client in the requesting CTCP message. If this switch is not given, the CTCP will contain the real IP address of the listening interface.
-f=<fake port> | --fake-port=<fake port>

Send the <fake port> as target port for the remote client in the requesting CTCP message. If this switch is not given, the CTCP will contain the real port of the listening socket.
All these switches are meant to allow maximum flexibility of the DCC negotiation, earlier KVIrc releases had serious problems with firewalled and/or masqueraded machines. With the -a and -f switches you can work around it.

-u | --unlimited
If the 'u' switch is given, the connection attempt will never time out; this might be useful if you want to leave a listening socket for a friend of yours while you are sleeping and have the CTCP processing disabled. The 'u' switch works either in active and passive mode.
-s | --ssl

Use a Secure Socket Layer for the transfer; the whole communication will be encrypted with a private key algorithm after a public key handshake.
This option will work only if the KVIrc executable has been compiled with SSL support and the remote end supports the SSL protocol too.
Please note that this will may down the transfer somewhat.
-s can be combined with -t.
The CTCP negotiation will use SSEND as parameter (or eventually TSSEND).
When requesting a SSL based DCC send to someone you probably will need a certificate. If you don't have one, create it (for example with CA.pl -newcert) and set it in the options dialog.

Syntax Specification

    dcc.send [-s] [-n] [-c] [-u] [-b] [-g[=<file size>]] [-t] [-m[=<boolean>]] [-i=<interface>] [-p=<port>] [-a=<fake address>] [-f=<fake port>] <nickname> [filename]

Index, Commands

KVIrc 4.2.0.6190 Documentation
Generated by root at Sun Jul 21 22:14:44 2013