The P2P protocol runs over TCP. The RPC protocol runs over JSON-RPC over HTTP over TCP.
This table describes the relevant default TCP/IP ports: