In WPNP there are basically two packet types above TCP/IP. The second packet type can have numerous "subtypes" indicating of what use that packet is, but that will be mentioned later.

The first packet type is that which a host cache will send. It is encoded, and simply contains a hostname in quad IP ASCII format followed by a colon and a port (e.g "127.0.0.1:3300"). It is not zero-terminated, and its length is given by TCP.

Connect to frontcode.com at port 7730 and wait for incoming data to get an example of this packet type.

The second packet type has got the following format:


 2 bytes: data length ("N"), little-endian
 ---- everything past this point is encoded ----
 2 bytes: packet subtype, little-endian
 N bytes: data

To decode the packet, one must start the decoding routine (which can be derived from the encoder at WPNP: Packet Encoding) at position 2 (skipping the first two bytes) and with length N+2 (N for data plus two for the packet subtype).

Most data is in clear text, separated by spaces.

The following subtypes has been found as of this time:

 2: Sent by a peer that logs in to another, and contains
 user name, password, client ("WinMX"), and some numbers
that have not yet been deciphered, separated by spaces. The
format is username, space, password, space, 0, space,
"WinMX" (with quotes), space, 8)

 3: Sent by the peer that listens to connections, as a 
response to packet subtype 2. Contains "nothing@nowhere.bla" 
as data (a fake e-mail address?).

 65494: Search request response. Contains file names and 
IDs of users that have the files.

Note that a peer may send multiple packets of the second type in a single TCP/IP packet. In this case, the length of the data returned by the recv function (in C) is going to be greater than N+4, and a new packet starts at that point.


To log in to a WinMX peer, first connect to one (get its IP by connecting to a host cache), then send 0x31 as the sole byte of a TCP packet, followed by "CLIE" (4 bytes) in another packet. After this, start transmitting and watching for type 2 packets, subtype 2(login) first.

Log in or register to write something here or to contact authors.