A protocol is bound to an underlying network which hold the characteristics of the "port" used for its communication. A communication protocol is used for the two sides of the communication, which means that any means of communicating data between Client and Server can be used.
The most simple of all protocols is an UDP protocol, (using UDP sockets), with one port for Client => Server communication, and one port for Server => Client communication. But any other mean of communication can be used, including non UDP protocols, or protocols using only one "port" equivalent for all communications. Developers are free to implement any Protocols they choose to, and even to add custom protocols as Extensions.
Note that even if UDP or TCP protocols use the notions or ports and hosts, protocols can even not use these notions at all. For example, the SharedMemoryProtocol uses direct ByteBufer communication to send or receive datas, and don't use ports or hosts. It is even not required to use separate communication for inputs or outputs.
AbstractProtocolclass to create your own protocol. To create custom Protocols, you have to declare a
ProtocolProviderclasspath in the manifest of an extension, for example: