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.
Note that the method codes in Version 4 are identical to the method codes in Version 3
| 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 in protocol version 4 are identical to method status codes of version 1.
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.
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).
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).
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).
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).
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).
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).
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).
This method is used to get any copied type from the server to the client. Once the client requests this method code from the server, and if the server has data of any supported type copied, it acknowledges the client with the status OK. Then the server sends the data type in a single byte. The following data types are supported.
| Data type | Type indicator byte (hex encoded) | Rest of the payload |
|---|---|---|
| Text | 01 | Rest of the payload is the same as the payload of the Get Text method, starting from the text length. |
| Files | 02 | Rest of the payload is the same as the payload of the Get Files method, starting from the number of files. |
| Copied image | 03 | Rest of the payload is the same as the payload of the Get Copied Image method, starting from the image size. |
Once the server sends the data type indicator byte, it sends the copied data, similar to the previous methods as mentioned above in the table. The client sends acknowledgement information to the server after successfully receiving the data item(s). Then, the communication ends, and the connection can be closed. The client may copy the received data item(s) to the clipboard of the client device.
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.
The device that received the last piece of data should acknowledge the sender with a single acknowledgement byte. This can be used to send the success or failure status of processing the received data.