# Tunnel Protocol
The P2PTunnel service provided by TUTK is similar to a VPN service. After the P2PTunnel service is started, it will forward the incoming data from the upper layer to the peer through the private protocol of TUTK, without knowing the IP address of the peer.
The P2PTunnel module can be embedded into the manufacturer's program or independently made into a module. For some TCP/IP based standard or private services, such as HTTP, SSH, FTP, telnet, and rtsp, access can be completed with just a few lines of code.
P2PTunnel Module Schematic Diagram
1.What to do if the local port is occupied?
- Just change the port
- For example, if the mapping between local port A and remote port C fails, you can switch to local port B and remote port B for mapping. After successful mapping, save the mapping record between local port A and remote port C
2.If the agent needs to connect multiple devices, how to distinguish different devices?
- Distinguish by different local ports, for example, if there are three devices listening to port 80, the agent can use 10001、10002、10003 to map the ports of these three devices, and then access 10001、10002、10003 to access these three devices.
3.Can P2PTunnelApis use the IOTC API？
- Yes, the parameter is SID.
4.Can P2PTunnel be used together with other modules (AV, RDT)?
- Yes, but it can be quite complex, and it is generally not recommended to use it together.