Protocol Version 2

If the client and the server agree on protocol version 2 after negotiation, the client starts communicating using that protocol. First, the client selects the method and requests it from the server. Then, the server accepts the request and continues the communication.

Selecting the Method

Selecting the method in protocol version 2 is identical to the procedure of selecting the method in protocol version 1.
Method codes in protocol version 2 are almost the same as the method codes in version 1, except for some differences in the Get Files and Send Files methods. They are described in the Supported Methods section.

Method Codes

Note that the method codes in Version 2 are almost the same as the method codes in Version 1

The supported method codes and their names.
Method code Method name
1 Get Text
2 Send Text
3 Get Files
4 Send Files
5 Get Image/Screenshot
125 Info

Method Status Codes

Method status codes in protocol version 2 are identical to method status codes of version 1.

Supported Methods

Most of the supported methods are identical to those of Version 1 except for the Get Files and Send Files methods.
Encoding of lengths, text, file names, file contents, and images and the maximum allowed text lengths, file name lengths, file sizes, and image sizes are identical to those of Version 1.

Get Text

This method is identical to the Get Text method of Version 1.

Send Text

This method is identical to the Send Text method of Version 1.

Get Files

This method is used to get the copied files and directories from the server to the client. The only difference between this method and the Get Files method of Version 1 is that Version 1 does not support sending directories, whereas this method of Version 2 supports sending directories in addition to files.

This method supports sending directories and files inside them using '/' (forward-slash) as the file path separator. All the file paths are considered relative paths.

Similar to the Get Files method of Version 1, the server starts by sending the number of files and then sends each file sequentially. Once all the files are transmitted, the communication ends, and the connection can be closed.

Send Files

This method is similar to the Get Files method except that the client sends the file count and each file sequentially to the server (i.e., the direction of communication after selecting the method is reversed). All the size limits and file path constraints are the same as the Get Files method described above.

Get Image/Screenshot

This method is identical to the Get Image method of Version 1.

Info

This method is identical to the Info method of Version 1.