简体   繁体   English

arduino(wifi防护板)和本地PC之间通过路由器连接

[英]Connection between arduino(wifi shield) and PC locally, with router

I want to connect my PC-with-arduino (server client) with TCP/IP socket. 我想将带有arduino的PC(服务器客户端)与TCP / IP套接字连接。 In my PC i have written java code to make this happen. 在我的PC中,我编写了Java代码来实现这一目标。 My questions are : I have to make port forwarding to my router? 我的问题是:我必须将端口转发到路由器吗? If yes, i will pass the port socket(client-server) into router? 如果是,我将端口套接字(客户端-服务器)传递到路由器吗? I have the zte zxv10 h108l router and i can't find any instructions about port forwarding for this model! 我有zte zxv10 h108l路由器,但找不到有关此型号端口转发的任何说明!

You say locally , which means you do not need any port forwarding. 在本地说,这意味着您不需要任何端口转发。 All your devices are on the same subnet, and you can directly open connections with each other. 您所有的设备都在同一子网中,并且您可以直接打开彼此的连接。

Port forwarding would only be necessary if something outside you network wants to open a connection to something inside. 仅当网络外部的某个设备想要打开与内部设备的连接时,才需要端口转发。 Basically, if something on the WAN side of the router wants to open a connection to something on the LAN side. 基本上,如果路由器的WAN端上的某个设备想要打开与LAN端上的某个设备的连接。 For example, you at a coffee shop on your laptop connecting to Arduino in your house. 例如,您在笔记本电脑上的咖啡店中连接到家中的Arduino。

Note that the reverse does not hold: something on the LAN side can open a connection to something on the WAN side with no port forwarding -- that is the NAT function of the router and is always active. 请注意,相反情况并不成立:LAN端的某些设备可以在没有端口转发的情况下打开与WAN端的设备的连接-这是路由器的NAT功能,并且始终处于活动状态。 For example, that is how your computer connects to stackoverflow with no special configuration on the router. 例如,这就是您的计算机在路由器上没有任何特殊配置的情况下连接到stackoverflow的方式。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM