EasyManua.ls Logo

Dobot M1 - Page 106

Dobot M1
140 pages
Print Icon
To Next Page IconTo Next Page
To Next Page IconTo Next Page
To Previous Page IconTo Previous Page
To Previous Page IconTo Previous Page
Loading...
Dobot M1 User Guide 6 Operation
Issue V1.3.4 (2019-05-23) User Guide Copyright © Yuejiang Technology Co., Ltd
103
import socketserver
import time
import math
class ThreadedTCPRequestHandler(socketserver.BaseRequestHandler):
def setup(self):
ip = self.client_address[0].strip()
port = self.client_address[1]
print(ip+":"+str(port)+" is connect!")
def handle(self):
while True: # add while for keep link
data = self.request.recv(1024)
if data:
data = str(data, encoding = 'ascii')
if data == 'exit':
break;
OperCMD(data)
#cur_thread = threading.current_thread()
#print what recieved
response = bytes("{}".format(data), 'ascii')
self.request.sendall(response)
def finish(self):
print("client is disconnect!")
print("stop")
server.shutdown()
exit(0)
class ThreadedTCPServer(socketserver.ThreadingMixIn, socketserver.TCPServer):
pass
def OperCMD(strCMD):
print(strCMD)
#decode command type
commandtype = strCMD[ : 3]

Table of Contents

Other manuals for Dobot M1

Related product manuals