当前位置:网站首页>关于php里tcp通讯用swoole框架出现的小问题
关于php里tcp通讯用swoole框架出现的小问题
2022-06-23 03:50:00 【mayday_80】
同事用php swoole框架搭的tcp通讯 但是一直跟外面的远程服务器通讯失败
就想着用python跟外面的远程服务器通讯测试是不是他写的数据格式是有问题的
# -*- codeing = utf-8 -*-
# @Time : 2022/6/22 10:58
# @Author: CXZ
# @Flie : tcp_client.py
# @Software: PyCharm
import socket
ip ="xx.xx.xx.xx"
port =8080
#ip ="127.0.0.1"
#port =5052
new_socket =socket.socket()#创建socket对象
new_socket.connect((ip,port)) #链接
#new_socket.send("abcde".encode(encoding='utf-8')) #发送数据 回应数据 write 对应server的read
new_socket.send(b'~\x80\x00\x02\x00\x00\x03RS\x81\x05\x87\x11\x00\x00%\x00\xb7~')
print('11111111')
#back_str = new_socket.recv(port).decode()#结束数据 请求数据 read 对应server的write
back_str = new_socket.recv(port)
print(bytes(back_str))
print((back_str.hex()))
new_socket.close()
忘记是在csdn看的哪个兄弟分享的代码了。。。。。。
我的测试是没有问题的,最后发现用php的原生tcp接口也是能正常跟远程服务器通讯的。但是用swoole确实不行。多嘴一下,好像unity里面同事用的api也是有这个问题。好像原生才是最简单粗暴有效的使用
边栏推荐
- 在线文本过滤小于指定长度工具
- How MySQL deletes a row of data in a table
- [learn FPGA programming from scratch -40]: Advanced - Design - competition and risk
- Inscription of lougu brush
- PTA:6-30 时间相加
- PTA:7-87 集合的模拟实现(类模板)
- Deploying Apache pulsar on kubesphere
- 深度学习 TensorFlow入门
- [binary tree] completeness test of binary tree
- QMainWindow
猜你喜欢

How to make the page number start from the specified page in word

抖音x-bogus和_signature参数分析

麦肯锡:2021年量子计算市场投资增长强劲,人才缺口扩大

距离度量 —— 余弦距离(Cosine Distance)

How node+express operates cookies

IDEA-导入模块

应急响应-hw复习

Leetcode 1208. Try to make the strings equal as much as possible (finally solved, good night)

【多模态】UNIMO

什么是元数据
随机推荐
Leetcode 1208. 尽可能使字符串相等(终于解决,晚安)
PTA:6-29 虚基类的应用-人与教师学生
Latest programming language rankings
深度学习 简介
[deep learning] deep learning reasoning framework tensorrt MNN openvino onnxruntime
Permission Operation in dynamics 365 plug-in
Pytoch --- use pytoch's pre training model to realize four weather classification problems
自动化测试常见的面试题
[learn FPGA programming from scratch -40]: Advanced - Design - competition and risk
Pta:7-85 data spacing (overload + function template)
在线JSON转CSharp(C#)Class工具
Pta:6-73 function call
Pytoch --- pytoch customizes the dataset
PTA:7-86 集合的模拟实现(函数模板)
众昂矿业:新能源新材料产业链对萤石需求大增
X24cxx series EEPROM chip C language universal reading and writing program
8位全加器原理
PTA:7-67 友元很简单2016final
Does the network disk also roll inside?
Leetcode 1208. Try to make the strings equal as much as possible (finally solved, good night)