How to use adb forward

If you’ve tried to use adb forward, you might have noticed that the official documentation is missing a lot of information. adb --help is a lot better:

forward [--no-rebind] LOCAL REMOTE
forward socket connection using:
tcp:<port> (<local> may be "tcp:0" to pick any open port)
localabstract:<unix domain socket name>
localreserved:<unix domain socket name>
localfilesystem:<unix domain socket name>
dev:<character device name>
jdwp:<process pid> (remote only)

If you want even more information, you can check out the source code, specifically SERVICES.TXT. It tells you about the forward command

Asks the ADB server to forward local connections from <local>
to the <remote> address on a given device.
There, <host-prefix> can be one of the
host-serial/host-usb/host-local/host prefixes as described previously
and indicates which device/emulator to target.
the format of <local> is one of: tcp:<port> -> TCP connection on localhost:<port>
local:<path> -> Unix local domain socket on <path>
the format of <remote> is one of: tcp:<port> -> TCP localhost:<port> on device
local:<path> -> Unix local domain socket on device
jdwp:<pid> -> JDWP thread on VM process <pid>
or even any one of the local services described below.

and gives more detailed information about what you can put for LOCAL and REMOTE.

Opens a device file and connects the client directly to it for
read/write purposes. Useful for debugging, but may require special
privileges and thus may not run on all devices. <path> is a full
path from the root of the filesystem.
Tries to connect to tcp port <port> on localhost.
Tries to connect to tcp port <port> on machine <server-name> from
the device. This can be useful to debug some networking/proxy
issues that can only be revealed on the device itself.
Tries to connect to a Unix domain socket <path> on the device
Variants of local:<path> that are used to access other Android
socket namespaces.