当前位置:网站首页>关于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也是有这个问题。好像原生才是最简单粗暴有效的使用
边栏推荐
- Latest programming language rankings
- Prince language on insect date class
- 离线数仓建模中常见的概念-术语
- How to ensure application security
- Leetcode 1208. 尽可能使字符串相等
- 摆烂LuoGu刷题记
- PTA:7-64 该日是该年的第几天
- PTA:7-63 计算高考状元
- Can MySQL be used in Linux
- Leetcode 1208. Try to make the strings equal as much as possible (finally solved, good night)
猜你喜欢

在线文本过滤小于指定长度工具

Analysis on the current situation of the Internet of things in 2022

Leetcode 1208. 尽可能使字符串相等(终于解决,晚安)

Avltree - arbre de recherche binaire équilibré

一篇文章学会er图绘制

12 excellent practices of wireless network security

Implementation of VGA protocol based on FPGA

Basic skills of x64dbg

Tiktok x-bogus and_ Signature parameter analysis

Cocos学习日记2——脚本和属性
随机推荐
PTA:6-30 时间相加
城链科技董事长肖金伟:践行数据经济系国家战略,引领数字时代新消费发展!
深度学习 简介
What are the characteristics of SRM supplier management system developed by manufacturing enterprises
距离度量 —— 余弦距离(Cosine Distance)
Create a desktop shortcut to your appimage
QT elidedText 只对中文符合起作用,对英文不起作用的问题解决
Online text filter less than specified length tool
自动化测试常见的面试题
Monitoring artifact ZABBIX, from deployment to application, goes deep layer by layer
什么是元数据
Leetcode 1208. 尽可能使字符串相等(终于解决,晚安)
在word里,如何让页码从指定页开始编号
2022年起重机械安全管理考试题库及答案
Flutter series: wrap in flutter
Pta:7-31 journal charges
2022年烷基化工艺考题及模拟考试
PTA:6-71 时钟模拟
How to make the page number start from the specified page in word
Pta:7-85 data spacing (overload + function template)