当前位置:网站首页>Small problems in the spoole framework for TCP communication in PHP
Small problems in the spoole framework for TCP communication in PHP
2022-06-23 05:04:00 【mayday_ eighty】
Colleagues use php swoole Framed tcp Communications But the communication with the external remote server has failed
Just want to use python There is a problem with the data format written by the remote server
# -*- 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()# establish socket object
new_socket.connect((ip,port)) # link
#new_socket.send("abcde".encode(encoding='utf-8')) # send data Response data write Corresponding server Of 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()# End data Request data read Corresponding server Of write
back_str = new_socket.recv(port)
print(bytes(back_str))
print((back_str.hex()))
new_socket.close()
Forget is in csdn See which brother shared the code ......
My test is OK , It turns out that php The native tcp The interface can also communicate with the remote server normally . But with swoole Does not work . Say something more , As if unity It is used by colleagues api There is also this problem . It seems that primordial is the simplest, roughest and most effective use
边栏推荐
- A mvc5+easyui enterprise rapid development framework source code BS framework source code
- Flask基础:环境搭建+配置+URL与试图之间的映射+重定向+数据库连接
- mysql json
- 电流继电器HDL-A/1-110VDC-1
- Shadertoy basic teaching 02. Drawing smiling faces
- Left and right values
- 重装Cadence16.3,失败与成功
- With the arrival of intelligent voice era, who is defining AI in the new era?
- Icer Skill 02makefile script Running VCS Simulation
- Common concepts and terms in offline warehouse modeling
猜你喜欢

Meituan's good article: understand swift, Objective-C and the mixing mechanism from the perspective of precompiling

重装Cadence16.3,失败与成功

PCB -- bridge between theory and reality

WPF 基础控件之 TabControl样式

DPR-34V/V双位置继电器

centos7安装postgresql8.2.15及存储过程创建

Install and run mongodb under win10

Apache atlas quick start

ICER skills 03design compile

The solution to prompt "this dictionary creation could be rewritten as a dictionary literal" when updating the dictionary key value in pychart
随机推荐
VGg Chinese herbal medicine identification
Li Kou today's question 513 Find the value in the lower left corner of the tree
物体结构图,快速图解物体内部结构
Abnova acid phosphatase (wheat germ) instructions
2 万字 + 20张图|细说 Redis 九种数据类型和应用场景
Shadertoy基础教学01、画圆(smoothstep()函数讲解)
Openwrt directory structure
重装Cadence16.3,失败与成功
WPF 基础控件之 TabControl样式
Abnova fluorescent dye 510-m streptavidin scheme
OGNL Object-Graph Navigation Language
Install and run mongodb under win10
接收传来得文件并下载(简单用法)a标签
How to better organize the minimum web api code structure
dolphinscheduler海豚调度升级代码改造-UpgradeDolphinScheduler
【图论】—— 二分图
What are the types of independent station chat robots? How to quickly create your own free chat robot? It only takes 3 seconds!
DPR-34V/V双位置继电器
PaddlePaddle模型服务化部署,重新启动pipeline后出现报错,trt报错
Welcome to the CSDN markdown editor