Protocol Version 4

If the client and the server agree on protocol version 4 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 4 is identical to the procedure of selecting the method in protocol version 1.
Method codes in protocol version 4 are identical to the method codes in version 3, except for the acknowledgement sent or received at the end and the changes in the Info method. These differences are described in the Supported Methods section.

Method Codes

Note that the method codes in Version 4 are identical to the method codes in Version 3

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
6 Get Copied Image Only
7 Get Screenshot Only
124 Get Any
125 Info

Method Status Codes

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

Supported Methods

Most of the supported methods are similar to those of Version 3, except for the acknowledgement sent or received at the end and the changes in the Info method.
The 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 previous versions.

Get Text

This method is similar to the Get Text method of previous versions, with the difference being that the client sends acknowledgement information to the server after successfully receiving the text (i.e., immediately before terminating the connection).

Send Text

This method is similar to the Send Text method of previous versions, with the difference being that the server sends acknowledgement information to the client after successfully receiving the text (i.e., immediately before terminating the connection).

Get Files

This method is similar to the Get Files method of Version 3, with the difference being that the client sends acknowledgement information to the server after successfully receiving all files (i.e., immediately before terminating the connection).

Send Files

This method is similar to the Send Files method of Version 3, with the difference being that the server sends acknowledgement information to the client after successfully receiving all files (i.e., immediately before terminating the connection).

Get Image/Screenshot

This method is similar to the Get Image method of previous versions, with the difference being that the client sends acknowledgement information to the server after successfully receiving the image (i.e., immediately before terminating the connection).

Get Copied Image Only

This method is similar to the Get Copied Image method of Version 3, with the difference being that the client sends acknowledgement information to the server after successfully receiving the image (i.e., immediately before terminating the connection).

Get Screenshot Only

This method is similar to the Get Screenshot method of Version 3, with the difference being that the client sends acknowledgement information to the server after successfully receiving the image (i.e., immediately before terminating the connection).

Info

This method is similar to the Info method of previous versions, with the exception that this method in version 4 can send some additional name-value pairs describing the server information after the server name, and the acknowledgement information is sent before terminating the connection.

Once the client requests this method code from the server, the server acknowledges the client with the status OK. Then, the server will send the length of the remaining payload, followed by the payload containing the server information, to the client. Once the information is transmitted, the client sends the acknowledgement information to the server. Then, the communication ends, and the connection can be closed.

Acknowledgement Information