I've only seen this used with IRC clients/servers, but it's a pretty simple protocol.
When the client connects to the IRC server, a random port is (usually) picked on the client side, so your local port may be 5000, and the remote port is what you connected to, usually 6667. The server then...