diff options
author | Edoardo La Greca | 2025-06-18 18:55:42 +0200 |
---|---|---|
committer | Edoardo La Greca | 2025-06-18 18:55:42 +0200 |
commit | 13421c537773cae59a4ca1fcc798ed3820634139 (patch) | |
tree | 02b757d5309081372043fbd3508b6cca3ef0e7c8 | |
parent | b55a746b1550b21e2b5cf3f5a2c08af7c88a661c (diff) |
rename NetworkManager to NetworkPacketTransporter
-rw-r--r-- | README.md | 27 |
1 files changed, 14 insertions, 13 deletions
@@ -21,30 +21,31 @@ Usage The most important class, and also the only one you'll need for basic usage, is `NinePConnection`. This class implements the 9P protocol on top of another unknown transport-layer protocol (although it's usually TCP) provided, and managed, by -a subclass of the `NetworkManager` abstract class. For this reason, the `NinePConnection`'s constructor requires an -instance of another class that implements `NetworkManager`. It doesn't need anything else. +a subclass of the `NetworkPacketTransporter` abstract class. For this reason, the `NinePConnection`'s constructor +requires an instance of another class that implements `NetworkPacketTransporter`. It doesn't need anything else. -The `NetworkManager` class provides abstraction over the specific networking methods. This makes the classes using -`NetworkManager` independent from both the specific networking API and the underlying transport-layer protocol of -choice. This allows swapping the API or protocol at any time and vastly improves portability. With all this considered, -since Java's standard library provides a networking API already, I thought that an implementation based on that would be -imperative, appreciated, and especially broadly used. +The `NetworkPacketTransporter` class provides abstraction over the specific networking methods. This makes the classes +using `NetworkPacketTransporter` independent from both the specific networking API and the underlying transport-layer +protocol of choice. This allows swapping the API or protocol at any time and vastly improves portability. With all this +considered, since Java's standard library provides a networking API already, I thought that an implementation based on +that would be imperative, appreciated, and especially broadly used. ```kotlin // This example uses one of the dial(2) formats for the address and port. val npconn: NinePConnection try { - npconn = NinePConnection(NetworkManagerJavaNet("net!9p.mydomain.com!564")) + npconn = NinePConnection(NetworkPacketTransporterJavaNet("net!9p.mydomain.com!564")) } catch (uhe: UnresolvableHostException) { // failed :( } ``` -While `NetworkManager` implementation initializes the transport-layer connection as soon as it's instanced, this is not -true for `NinePConnection` and the 9P connection. The reason why the 9P protocol is not immediately initialized is that -`NinePConnection` only exposes methods that coincide with the protocol messages, which means that providing an automated -way to initialize the protocol would mix two levels of abstraction in the same class. For this purpose, the `initNineP` -function is a shorthand that can do it for you, although it's possible to do so manually by using the 9P primitives. +While `NetworkPacketTransporter` implementation initializes the transport-layer connection as soon as it's instanced, +this is not true for `NinePConnection` and the 9P connection. The reason why the 9P protocol is not immediately +initialized is that `NinePConnection` only exposes methods that coincide with the protocol messages, which means that +providing an automated way to initialize the protocol would mix two levels of abstraction in the same class. For this +purpose, the `initNineP` function is a shorthand that can do it for you, although it's possible to do so manually by +using the 9P primitives. A word on Android ----------------- |