Hans Prestige Turbo DCC Specification
Visual IRC
   Features & Screenshots
   Download ViRC!
   Scripts

   Visual IRC Forum
   Chat in Undernet #ViRC

   Awards and Reviews
   About the Author
   About the Technology
ViRC Antique Shop

CTCP Handshake

Old handshake
DCC TSEND filename encoded-ip port size
New handshake
DCC SEND filename encoded-ip port size T
  • filename - The name (without path) of the file being sent. The filename may contain spaces if it's surrounded by double quote marks ("file with spaces.txt").
  • encoded-ip - The sender's IPv4 address, expressed as a single number. The number is obtained by interpreting the 32-bit IP address as an unsigned integer in network byte order (most significant byte first).
  • port - The port on which the sender is listening for a TDCC connection.
  • size - The size of the file in bytes.

Any further handshaking for DCC Resume takes place just as in regular DCC.

Sending

The sender waits for the receiver to connect to the advertised port. Once a connection is made, the sender immediately begins sending the file, with no pauses or interruptions. (If a DCC Resume has been negotiated, the file will be sent starting at the negotiated offset; otherwise, it is sent from the beginning.) When the entire file has been sent, the sender waits for the receiver to close the socket.

Receiving

The receiver connects to the sender's advertised IP address and port. Once the connection is made, the receiver begins reading data as fast as possible from the socket and writing it to a local file, with no pauses or interruptions. When the entire file has been received (as determined by the advertised file size), the receiver closes the socket.

Changes for Reverse TDCC

Reverse TDCC uses a different handshake:

DCC SEND filename encoded-ip 0 size token

... where token is a non-negative integer followed by the letter T. The integer must be unique for each file being sent by the same client at any given time. (The same token is included at the end of any DCC RESUME or DCC ACCEPT messages dealing with this connection.)

Notice the port is 0; this signals to the receiver that the sender is requesting Reverse (T)DCC. The receiver opens a connection on a port of its choice and responds with a similar handshake:

DCC SEND filename encoded-ip port size token

This message is sent as a CTCP request, not a CTCP reply, as if the receiver is attempting to send this file to the sender! (This may require the sender to add the receiver to his "DCC Allow" list on some networks.) The message can be identified as the second half of a Reverse DCC transaction because the token is present and the port is nonzero.

In this second handshake, encoded-ip and port refer to the IP address and port being used by the receiver, since the receiver opens the connection in Reverse DCC. The sender connects to that port, and as soon as the connection is made, the file transfer takes place as usual. The sender still waits for the receiver to close the socket when the file is finished.

© Jesse McGrew 2001-2007