After the last realization of the RFID and Raspberry sent to the communication, today to try to transfer data from the RFID through the TCP/IP protocol to moxa and then transmitted to the cloud.
Since the two MOXA3121 and the other one have not been well understood (forget ... ) delivery mechanism, the Raspberry faction carries on the wireless transmission, in order to verify the usability of the program, simplifies the notebook as the cloud, uses the network cable to connect the raspberry Pie network mouth and the notebook's net mouth.
Although still in the process of debugging encountered difficulties, but before debugging the serial port experience, finally in the afternoon or basically realize the function.
It is to be noted that:
1, for TCP/IP protocol transmission, we must ensure that the server and client located in the same network segment
This, in the initial trial of the TCP debugging assistant, found that only using a network cable to connect the desktop and notebook network port does not implement the TCP debugging assistant communication. Thinking after the discovery, the desktop IP set to 192.168.127.222, and the IP of the notebook is 192.168.137.1, the two are not a network segment at all. After the desktop was changed to 137, the two moxa IP was changed to 192.168.137.252, 192.168.137.201. Successful implementation of the most basic communication.
2, the client's socket in the settings must use the server's IP and port ...
Socket programming in the server, the port needs to indicate that IP with inaddr_any (Let server monitor all IP). And the client needs to connect the information of the server port with the information of the IP and Client_socket. The client's port is specified by the computer itself.
Still need to do the work:
1, sleep function mechanism, why the parameter <1 time, too fast. Causing the raspberry pie to send and receive instructions in a reasonable way.
2, the real implementation of the remote transmission of data to Moxa
3, the program modular, increase the readability and introduction of the program