(thing) |
(Remove dead link) |
||
(8 intermediate revisions by 5 users not shown) | |||
Line 1: | Line 1: | ||
[[File:P3 Settings.png|thumb|The P3 settings program.]] | |||
'''Pseudo Peer-to-Peer''' | P3, also known as '''Pseudo Peer-to-Peer''' or '''PPP''', is a communication protocol and program that was introduced in Windows96 v2.34 ([[Windows 96 v2]] Service Pack 2). Its purpose is to allow developers to have intercommunication between programs, without having to rely on hosting a server themselves. | ||
P3 | P3 has been marked as obsolete since [[Windows 96 v3]] release 3.0.1, with no replacement being officially announced. | ||
== Network function == | |||
In order to initiate a connection with a peer, the system must first connect to a P3 relay server (by default, this server is <code>wss://p3.windows96.net</code>) using Socket.IO. The relay handles address assignment, authentication, message exchange and peer discovery. | |||
=== HELLO === | |||
Logging in on the relay is accomplished by sending a <code>hello</code> packet containing the address secret as well as the desired subdomain in a JSON-encoded, semicolon-separated string. | |||
["sub=hello;mySecret"] | |||
If the user does not wish to use a subdomain, the <code>sub</code> argument can be omitted: | |||
["mySecret"] | |||
If the user has a [[Windows 96 Product Key]], the secret is ignored, and the key's domain is used instead. Product key authentication is done by sending the <code>Authorization</code> HTTP header before connecting: | |||
Authorization: Bearer <product-key> | |||
Successful authentication will result in a <code>hello</code> response, indicating the user's address, secret and MOTD if the server has one: | |||
[{ "success": true, "address": "hello.kyblozsdhc.ppp", "secret": "mySecret", "message": "example MOTD" }] | |||
Invalid parameters will result in a message containing the error: | |||
[{ "success": false, "message": "PPP Server Error: Subdomain is invalid" }] | |||
=== PACKET === | |||
Messages can be exchanged between peers using the <code>packet</code> message. A <code>packet</code> message must contain the destination address, n<sub>once</sub> and data. | |||
The destination address can be any valid <code>.ppp</code>, <code>.vip</code> or <code>.sys</code> address, optinally with a port added as a suffix, such as <code>lo.sys:1234</code>. | |||
The n<sub>once</sub> component is a single number that increases on each packet sent. This can allow for error detection and prevents old packets from being received twice. | |||
Example <code>packet</code> message: | |||
[{ "dest": "1424vqhvtu.ppp:28067", "nonce": 77, "data": "hello, world" }] | |||
If the message was sent successfully, the relay server replies with <code>packet.ok</code> and the n<sub>once</sub>: | |||
[ { "nonce": 77 } ] | |||
If the peer is offline, the <code>packet.err</code> message is sent with the error message and n<sub>once</sub>: | |||
[ { "nonce": 77, "message": "Peer offline" } ] | |||
=== PORT.PUBLISH === | |||
The <code>port.publish</code> message registers a peer's port on network discovery. The message must contain the port that the peer wants to publish, and the identifier flags that other peers can search for with the <code>discover</code> message. | |||
Example <code>port.publish</code> message for port 1234, with the flags <code>foo</code> and <code>bar</code>: | |||
[ 1234, ["foo", "bar"]] | |||
'''No reply is sent on success or error.''' | |||
=== PORT.REMOVE === | |||
The <code>port.remove</code> message removes the specified port from network discovery. | |||
Example <code>port.remove</code> message to remove port 1234: | |||
[ 1234 ] | |||
'''No reply is sent on success or error.''' | |||
=== DISCOVER === | |||
The <code>discover</code> message allows peers to automatically find each other on the network. Programs can use this packet to find peers on the network running the same protocol and contact them. | |||
The message must contain the flags to look for, the peer limit, and n<sub>once</sub>. | |||
[ ["flag1", "flag2"], limit, nonce ] | |||
Example packet to find all peers with the <code>foo</code> flag: | |||
[ ["foo"], 0, 8 ] | |||
Example packet to find at max 10 peers with the <code>foo</code> or <code>bar</code> flag: | |||
[ ["foo", "bar"], 10, 9 ] | |||
Successful replies are sent with the <code>discover</code> message, containing a list of peer addresses, ports, flags, and the n<sub>once</sub>: | |||
[ [ { "port": "1234", "address": "1424vqhvtu.ppp", "flags": ["foo"] ], 9 ] | |||
If an error occurred, the <code>discover.err</code> message is sent instead: | |||
[ "Invalid limit", 9 ] | |||
== Use == | |||
* [[SuperTerm]] uses the Rich Text over P3 (RToP) protocol with 121 as default port. | |||
* [[Remote Console]] uses RToP on port 140. | |||
* [[P3FS]] uses P3 on port 737. | |||
== External links == | |||
* [https://github.com/socketio/socket.io Socket.IO on GitHub] | |||
* [https://github.com/themirrazzalt/p3protocol Unofficial P3 documentation] |
Latest revision as of 12:35, 3 July 2023
P3, also known as Pseudo Peer-to-Peer or PPP, is a communication protocol and program that was introduced in Windows96 v2.34 (Windows 96 v2 Service Pack 2). Its purpose is to allow developers to have intercommunication between programs, without having to rely on hosting a server themselves.
P3 has been marked as obsolete since Windows 96 v3 release 3.0.1, with no replacement being officially announced.
Network function
In order to initiate a connection with a peer, the system must first connect to a P3 relay server (by default, this server is wss://p3.windows96.net
) using Socket.IO. The relay handles address assignment, authentication, message exchange and peer discovery.
HELLO
Logging in on the relay is accomplished by sending a hello
packet containing the address secret as well as the desired subdomain in a JSON-encoded, semicolon-separated string.
["sub=hello;mySecret"]
If the user does not wish to use a subdomain, the sub
argument can be omitted:
["mySecret"]
If the user has a Windows 96 Product Key, the secret is ignored, and the key's domain is used instead. Product key authentication is done by sending the Authorization
HTTP header before connecting:
Authorization: Bearer <product-key>
Successful authentication will result in a hello
response, indicating the user's address, secret and MOTD if the server has one:
[{ "success": true, "address": "hello.kyblozsdhc.ppp", "secret": "mySecret", "message": "example MOTD" }]
Invalid parameters will result in a message containing the error:
[{ "success": false, "message": "PPP Server Error: Subdomain is invalid" }]
PACKET
Messages can be exchanged between peers using the packet
message. A packet
message must contain the destination address, nonce and data.
The destination address can be any valid .ppp
, .vip
or .sys
address, optinally with a port added as a suffix, such as lo.sys:1234
.
The nonce component is a single number that increases on each packet sent. This can allow for error detection and prevents old packets from being received twice.
Example packet
message:
[{ "dest": "1424vqhvtu.ppp:28067", "nonce": 77, "data": "hello, world" }]
If the message was sent successfully, the relay server replies with packet.ok
and the nonce:
[ { "nonce": 77 } ]
If the peer is offline, the packet.err
message is sent with the error message and nonce:
[ { "nonce": 77, "message": "Peer offline" } ]
PORT.PUBLISH
The port.publish
message registers a peer's port on network discovery. The message must contain the port that the peer wants to publish, and the identifier flags that other peers can search for with the discover
message.
Example port.publish
message for port 1234, with the flags foo
and bar
:
[ 1234, ["foo", "bar"]]
No reply is sent on success or error.
PORT.REMOVE
The port.remove
message removes the specified port from network discovery.
Example port.remove
message to remove port 1234:
[ 1234 ]
No reply is sent on success or error.
DISCOVER
The discover
message allows peers to automatically find each other on the network. Programs can use this packet to find peers on the network running the same protocol and contact them.
The message must contain the flags to look for, the peer limit, and nonce.
[ ["flag1", "flag2"], limit, nonce ]
Example packet to find all peers with the foo
flag:
[ ["foo"], 0, 8 ]
Example packet to find at max 10 peers with the foo
or bar
flag:
[ ["foo", "bar"], 10, 9 ]
Successful replies are sent with the discover
message, containing a list of peer addresses, ports, flags, and the nonce:
[ [ { "port": "1234", "address": "1424vqhvtu.ppp", "flags": ["foo"] ], 9 ]
If an error occurred, the discover.err
message is sent instead:
[ "Invalid limit", 9 ]
Use
- SuperTerm uses the Rich Text over P3 (RToP) protocol with 121 as default port.
- Remote Console uses RToP on port 140.
- P3FS uses P3 on port 737.