Pre-requisites: Node list from Peer Cache - Username string - WPN Line/Connection Type number - Secondary clients TCP Port - Default Status string.
Scenario: We are about to connect to a WPN Primary node as a Secondary client.
Lets begin by contacting a Primary Node utilising the info we have obtained from a Peer Cache node list
The primary client will respond with a 31 (ASCII "1" character)
Our KeyBlock (16 bytes) calculated in the following way.
WPNP KEY IDs 0x0050 : Primary Client
0x0051 : Primary Server
0x0052 : Secondary Client
0x0053 : Secondary Server
0x0054 : Cache Node List
0x0057 : Chat Client
0x0058 : Chat Server
(IN) Crypt Key ID.
pBlock : (OUT) Key Block ( 16 bytes )
BYTE KeyBlock[16];
CreateCryptKeyID(WPN KEY ID, KeyBlock);The Primary now sends us its Keyblock (16 bytes)
We now use the relevant keyblocks in a cryptographic process that continues throughout further packet exchanges.
At this stage the primary delivers us another node list that we cache locally in case we need to change primarys.
We now send the 0x03E9 packet in the following format.
[ 0x03E9 ][ Packet Data Length : 2 ][ UserName : S ][ 00 : 1 ][ LineType : 2 ][ TCP Port : 2 ] = [ E9 03 ][ 0F 00 ][ 47 75 6D 64 72 6F 70 36 30 39 ][ 00 ][ 08 00 ][ 4A 09 ]
In reply we will receive the following information from the Primary Node, most often as a fragmented packet.
[ 0x0460 ][ Packet Data Length : 2 ] [ Client ID : 2 ] = [ 60 04 ][ 02 00 ] followed immediately with a client ID for this session [16 53]
We now contact the primary with a "Status" message
[ 0x0384 ] :"900x x of y available" = [ 84 03 ][15 00 ][39 30 30 36 20 36 20 6F 66 20 36 20 61 76 61 69 6C 61 62 6C 65] (9006 6 of 6 available)
X and Y are numerical values in actual results representing the total amount of file transfer slots (X), and those still available (y)
Followed by packet 038D giving our UserName once more plus the client ID we have been assigned.
[ 0x038D ][ User Name : S ][ 00 : 1 ] = [ 8D 03 ][ 11 00 ][ 47 75 6D 64 72 6F 70 36 30 39 5F 35 35 39 32 38 ][ 00 ]
Our network identity is thus GumDrop609_55928 and we will need to continue to send regular status packets to stay connected.