update 添加通讯等基本框架

This commit is contained in:
FrankCV2048
2024-08-06 22:57:27 +08:00
parent bbcd0dd866
commit e8e96d9a97
4 changed files with 53 additions and 1 deletions

24
COM/COM_TCP.py Normal file
View File

@ -0,0 +1,24 @@
import json
import socket
class TCPClient:
def __init__(self,ip,port):
self.IPAddress = ip
self.port = port
self.client_socket = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
def CreatConnect(self):
self.client_socket.connect(self.IPAddress, self.port)
def is_Connect(self):
try:
self.client_socket.send(b'', socket.MSG_DONTWAIT)
return True
except OSError:
return False