import socket
import time
#import numpy as np
HOST = ‘192.168.2.11’
ctrl_socket = 0
data_socket = 0
ctrl_port = 8000
data_port = 8001
ctrl_socket = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
data_socket = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
# family: 串接的類型可分為 IPv4本機、IPv4網路、IPv6網路,type: 串接可分為TCP/UDP
# ctrl_socket = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)
# data_socket = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)
ctrl_socket.connect((HOST, ctrl_port))
# 用於客戶端指定要串接的IP位址跟Port號
time.sleep(0.2)
data_socket.connect((HOST, data_port))
print(data_socket)
print(ctrl_socket)
data_socket.send(b’Config’)
Jupyter:
推薦hahow線上學習python: https://igrape.net/30afN
近期留言