Open main menu
Home
Random
Log in
Settings
About RobotX
Disclaimers
RobotX
Search
Changes
Holonomic Robotic Platform
← Older edit
Newer edit →
Holonomic Robotic Platform
(view source)
Revision as of 20:20, 1 January 2020
584 bytes added
,
20:20, 1 January 2020
m
→Robot Code for Robot/Laptop Base Communication
Line 55:
Line 55:
</source>
</source>
====Robot Code for Robot/Laptop Base Communication ====
====Robot Code for Robot/Laptop Base Communication ====
+
import socket
+
serv = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
+
serv.bind(('192.168.1.43',13000))
+
serv.listen(5)
+
while True:
+
conn, addr = serv.accept()
+
message_from_client = ''
+
while True:
+
data = conn.recv(4096)
+
if not data: break
+
message_from_client = data.decode()
+
print ("Tx:" + message_from_client)
+
message = "RxAck:" + message_from_client
+
conn.send(message.encode())
+
conn.close()
+
if message_from_client == "Stop the Server" : break
+
print ('Communication protocols termintated at Server by Client')
Joelmartin
Bots
,
Bureaucrats
, contributor,
Interface administrators
, lookupuser,
Administrators
4,000
edits