-
Notifications
You must be signed in to change notification settings - Fork 1
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
转ws收发正常,转tcp能发不能收 #2
Comments
你的测试服务代码有问题,连上后就断开了。
|
import socket
def tcp_server(host, port):
# 创建一个TCP套接字
with socket.socket(socket.AF_INET, socket.SOCK_STREAM) as server_socket:
# 绑定到指定的主机和端口
server_socket.bind((host, port))
# 开始监听传入的连接
server_socket.listen()
print(f"Server listening on {host}:{port}")
if name == "main":
HOST = '127.0.0.1' # 服务器主机
PORT = 12345 # 服务器端口
tcp_server(HOST, PORT)
使用上述简单的tcp服务器进行测试,连接正常,发送正常,但是收不到数据。
测试工具:http://wstool.js.org/
测试地址:ws://10.15.101.99:1443?token=127.0.0.1:12345
The text was updated successfully, but these errors were encountered: