Objective
Last year's Raspberry Pi has been in the drawer to eat ash, the previous array of Debian 9 released, there is no accidental support for the Raspberry Pi.
Then re-took out the card reader and re-installed on the Debian Desktop version of the system.
Introduced
Now this thing is just a little bit more about Python and. NET communication. The best version should be that the Raspberry Pi command can be executed remotely from the server side.
The reasons for doing so we all know, many broadband now do not provide an external network IP, so that the family does not have a public IP, there is no way to remote control of the Raspberry Pi, I want to do something similar to the intranet penetrate Ngrok and the like.
Effect
Python side
#!/usr/bin/env python2#-*-coding:utf-8-*-import socketimport threadingimport oshost = ' 192.168.31.7 ' port = 5001s = Sock Et.socket (socket.af_inet, socket. Sock_stream) S.connect ((host, Port)) def Start (): a = 0 while True: a = a+1 data = str (a). Encode (' UTF8 ') + Getcputemperature (). Encode (' UTF8 ') #s. Send (Str (a). Encode (' UTF8 ')) print (data) #print (data) Threading._sleep () def getcputemperature (): res = Os.popen (' Vcgencmd measure_temp '). ReadLine () return ( Res.replace ("temp=", "" "). Replace (" ' c\n "," ")) if __name__ = = ' __main__ ': Start ()
Very simple code snippet, this time next week should be able to write the approximate prototype, this server now test the stability of the server side.