当前位置:网站首页>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
边栏推荐
- ICer技能03Design Compile
- Abnova actn4 purified rabbit polyclonal antibody instructions
- The solution to prompt "this list creation could be rewritten as a list literal" when adding elements to the list using the append() method in pychart
- dolphinscheduler海豚调度升级代码改造-UpgradeDolphinScheduler
- With the arrival of intelligent voice era, who is defining AI in the new era?
- Flask基础:环境搭建+配置+URL与试图之间的映射+重定向+数据库连接
- DSP7 环境
- STL教程3-异常机制
- Abnova fluorescent dye 555-c3 maleimide scheme
- Apache atlas quick start
猜你喜欢

Flask基础:环境搭建+配置+URL与试图之间的映射+重定向+数据库连接

Abnova blood total nucleic acid purification kit protocol

How to solve multi-channel customer communication problems in independent stations? This cross-border e-commerce plug-in must be known!

Amazing tips for using live chat to drive business sales

ICer技能03Design Compile

AlertManager告警的单独使用及prometheus配置告警规则使用

Notepad++ find replace group replace retain

Halcon knowledge: binocular_ Discrimination knowledge

微信小程序实例开发:跑起来

Shadertoy基础教学02、画笑脸
随机推荐
Abnova abcb10 (human) recombinant protein specification
静态双位置继电器GLS-3004K/DC220V
欢迎使用CSDN-markdown编辑器
【图论】—— 二分图
【OFDM通信】基于matlab OFDM多用户资源分配仿真【含Matlab源码 1902期】
2 万字 + 20张图|细说 Redis 九种数据类型和应用场景
Common concepts and terms in offline warehouse modeling
Flask Foundation: environment setup + configuration + mapping between URL and attempt + redirection + database connection
395. redundant path
Seven year manong Road
Cve-2019-14287 (sudo right raising)
《微信小程序-基础篇》带你了解小程序的路由系统(二)
Can bus Basics
Summary of switched reluctance motor suspension drive ir2128
Alkylation process test questions and simulation test in 2022
Thinkphp6 template replacement
Const understanding one
Chrome debugging tips
prometheus、influxdb2.2安装及flume_export下载编译使用
Actual combat | multiple intranet penetration through Viper