Welcome to the PtokaX Wiki!
This wiki is devoted to let users share information on the great hubsoft PtokaX. However, it is not limited to PtokaX, it is destined to share and discuss information on different parts of the LUA programming language, but the site is NOT intended to be a replacement for the primary LUA Board aka the PtokaX Portal, nor the secondary LUA Board or the PtokaX resources.
If you’re not familiar with wikis then in short: they are user-contributed sites: pages can be edited by (almost) anyone. As such, there is always kind of up-to-date and (hopefully) proper content. They are better than forums, since relevant pieces of information are on the same page. Do not hesitate to share your knowledge, and we all hope you can learn and teach a lot here! — bastya_elvtars
Trace: » Server to Hub Registration Server Communication » Setting up PtokaX » experimental » Client to Client HandShake
Client to Client HandShake
$MyNick
The listen User sends his Name when a user connecting.
$MyNick <ownnickname>
<ownnickname>is the nick of the user that sent to command.
The $Lock is sent immediately after the $MyNick command within the same packet.
$Lock <lock> Pk=<pk>
<lock>is used to generate<key>
See Appendix A: Converting a Lock into a Key for how to compute the key from the lock.
- <pk> is unused, but SG believes Pk stands for “private” or “public key”.
Immediately following the $MyNick + $Lock packet the connecting user sends their $MyNick + $Lock in the same fashion as above.
$Direction
The $Direction command is a part of the response packet to the $Lock + $MyNick packet.
$Direction <direction> <anumber>
<direction>is either Upload or Download depending on if your client is uploading or downloading.<anumber>is a random number, when both clients want to start downloading then one with higher number starts first.
After the $Direction command we must send the $Key command (still with in the $Direction packet) in response to the other clients lock.
$Key <key>
<key>is generated from the other users <lock>
See Appendix A: Converting a Lock into a Key for how to compute the key from the lock.
The users are now connected.
$Send
The $Send command informs the uploading client, that the download will start.
$Send
Direct Connect sends upload data in chunks of 40906 bytes. After every 40906 bytes is recived the downloading client must send the $Send again.
Download Example:
Client <-> Client Communication in DC. 11-05-2002. By aDe ----------------------------------------------------------
ACTIVE FILE DOWNLOAD ---------------------- D = downloader U = uploader H = hub
D>H: $ConnectToMe <U's username> <D's IP and port>| H>U: $ConnectToMe <U's username> <D's IP and port>| U>D: Connection U>D: $MyNick <U's nick>|$Lock <new lock with pk>| D>U: $MyNick <D's nick>|$Lock <new lock with pk>|$Direction Upload <anumber>|$Key <key for U's lock>| U>D: $Direction Download <anumber>|$Key <key for D's lock>| D>U: $Get <filepath + filename in exact case>$<start at byte (1=beginning of file)>| U>D: $FileLength <length of the requested file>| D>U: $Send| U>D: Data, in many chunks. D>U: $Send| <- when 40906 bytes are sent, ask for more
You are here: About the Wiki » misc » dcprotocol » Client to Client HandShake