Comments (28)
怎么看都好像被云主机限制了😂
你自定义协议通信部分没有什么问题,就是http server收不到40000字节上以上的请求是吗?
from workflow.
另外你这个自定义协议,可以用我们protocol里的TLVMessage。
from workflow.
怎么看都好像被云主机限制了😂
你自定义协议通信部分没有什么问题,就是http server收不到40000字节上以上的请求是吗?
是的40000以上就不行了,那我再去看看😭
from workflow.
另外你这个自定义协议,可以用我们protocol里的TLVMessage。
好的,主要刚开始接触workflow,我想都试试后面会尝试的😁
from workflow.
怎么看都好像被云主机限制了😂
你自定义协议通信部分没有什么问题,就是http server收不到40000字节上以上的请求是吗?是的40000以上就不行了,那我再去看看😭
嗯嗯,看看你的云主机有没有什么参数限制。我觉得某些安全机制可能会让云主机限制http请求的大小,避免用户的http server被攻击。
from workflow.
怎么看都好像被云主机限制了😂
你自定义协议通信部分没有什么问题,就是http server收不到40000字节上以上的请求是吗?是的40000以上就不行了,那我再去看看😭
嗯嗯,看看你的云主机有没有什么参数限制。我觉得某些安全机制可能会让云主机限制http请求的大小,避免用户的http server被攻击。
这边测试过了,没有限制带宽。忘记补充了,我的做业务的服务器直接读的workflow发过来的数据自己手动解析的,并未使用worklfow当做另一端,两边不是对称的(都使用的workflow)。这样会有问题吗?
from workflow.
都是http协议,无论如何都是可以互通的啊。
你尝试用我们tutorial里的http_echo_server,让外部发一个40KB以上的请求,看看能不能立刻响应。
from workflow.
params.peer_response_timeout = 100;
这一行也可以先去掉试试。这个表示请求数据每两个包之间最多间隔100ms。
from workflow.
params.peer_response_timeout = 100; 这一行也可以先去掉试试。这个表示请求数据每两个包之间最多间隔100ms。
这个是我做业务读TCP数据的代码
#include "../include/iodevice.h"
#include "../include/utility.h"
IoDevice::IoDevice(int socket) : _socket(socket) {}
int IoDevice::boundary_recv(std::string &buf)
{
char buffer[1024];
int ret = ::recv(_socket, buffer, 4, MSG_WAITALL);
ERROR_CHECK(ret == -1, "boundary recv error which is -1");
if (ret == 0)
return 0;
size_t len = *(size_t *)buffer, hash_recv = 0;
while ((ret = ::recv(_socket, buffer, std::min(1024UL, len - hash_recv), MSG_WAITALL)) > 0)
{
if (ret == -1 && (errno & EAGAIN))
continue;
else if (ret == -1)
return -1;
buf.append(buffer, ret), hash_recv += ret;
}
return hash_recv;
}
int IoDevice::boundary_send(const std::string &buf)
{
int len = buf.size(), has_send = 0;
int ret = ::send(_socket, &len, sizeof(len), 0);
ERROR_CHECK(ret == -1, "boundary send data size error");
return send(buf);
}
int IoDevice::send(const std::string &buf)
{
int ret;
size_t len = buf.size(), has_send = 0;
while ((ret = ::send(_socket, buf.data() + has_send, std::min(1024UL, len - has_send), MSG_DONTWAIT)) > 0)
{
if (ret == -1 && (errno & EWOULDBLOCK))
continue;
else if (ret == -1)
return -1;
has_send += ret;
}
return has_send;
}
int IoDevice::recv(std::string &buf)
{
int ret = 0, bytes_read = 0;
char buffer[1024];
while ((ret = ::read(_socket, buffer, 1024)) > 0)
{
if (ret == -1)
return (errno & EAGAIN) ? bytes_read : -1;
buf.append(buffer, ret), bytes_read += ret;
}
return bytes_read;
}
我的疑问是在这个问题上面,create_client_task是不是有什么确认机制,确认连接存在呢?这边刚测试了100000字节的基本上发一多半链接就关闭了。我明天会试试workflow对称收发。
PrivateTask *tcp_task = NTF::create_client_task(TT_TCP, "tcp://xxxxxxxx:xxxxx", 1, PrivateProtocalCallback);
from workflow.
你编码的时候执行了htonl转成网络序了,但boundary_recv里没有转啊。那肯定是错误的。
from workflow.
并且,encode时用的是uint32_t,接收又使用size_t。
还有,(errno & EAGAIN)又是什么意思,不应该是(errno == EAGAIN)吗?
from workflow.
并且,encode时用的是uint32_t,接收又使用size_t。
还有,(errno & EAGAIN)又是什么意思,不应该是(errno == EAGAIN)吗?
这一块确实写的有问题已经改正了,htonl转成网络序我是在发送数据之前转换过了,IODevice只负责发送数据。改正之后再次测试,本地确实可以收发,收一次数据的过程基本收一半多断开了。我将两个进程一起放在云服务器上,最后的HTTP报文是可以完整收到的,说明服务器带宽没有限制
6832
head: 726560
13068 5808 1452 2904 5808
1452 2904 2904 2904 2904
2904 2904 2904 2904 2904
2904 2904 2904 2904 2904
2904 2904
Error: Connection timed out
打印信息实在这里加上的
int PrivateProtocal::append(const void *buf, size_t size)
{
std::cout << size << "\n";
// 获取头部信息直到获取完毕
if (this->head_received < 4)
{
void *p = &this->head[head_received];
size_t need = std::min(4 - this->head_received, size);
size -= need, this->head_received += need;
memcpy(p, buf, need);
if (size <= 0)
return 0;
buf = (const char *)buf + need;
p = this->head;
this->body_size = ntohl(*(u_int32_t *)p);
if (this->body_size > this->size_limit)
{
errno = EMSGSIZE;
return -1;
}
this->body = (char *)malloc(sizeof(char) * this->body_size);
if (!this->body)
return -1;
this->body_received = 0;
std::cout << "head: " << this->body_size << "\n";
}
...................
from workflow.
你编码的时候执行了htonl转成网络序了,但boundary_recv里没有转啊。那肯定是错误的。
这是我云服务器发给本地HTTP网关的数据,我在IODevice发送消息data前会再发送一个4字节的头部指定此次发送数据大小,不知道这样对不对
void task(void *eventloop, int socket, int type, const std::string &query)
{
// std::cout << pthread_self() << std::endl;
// std::this_thread::sleep_for(std::chrono::seconds(1));
std::string res;
if (type == 1)
res = Dictionary::GetInstance()->query(query), type = 100;
else if (type == 2)
res = webquery.query(query), type = 200;
std::cout << "取得" << res.size() << "\n";
std::string data(8 + res.size(), '\0');
*(int *)data.data() = ::htonl(4 + res.size()); //根据PrivateProtocal指定协议的头部大小
*((int *)data.data() + 1) = type; //这一块自己用的数据
::memcpy(data.data() + 8, res.data(), res.size()); //这一块自己用的数据
EventLoop *loop = (EventLoop *)eventloop;
loop->appendSendPoll(std::make_pair(socket, data));
}
from workflow.
你真正上线还是直接用我们的TLVMessage吧,完全就是你需要的结构。你代码这写法,我也搞不清楚还会有什么问题。
from workflow.
你真正上线还是直接用我们的TLVMessage吧,完全就是你需要的结构。你代码这写法,我也搞不清楚还会有什么问题。
好
from workflow.
http server从外网接收大数据问题已经解决了是吧?
from workflow.
http server从外网接收大数据问题已经解决了是吧?
😭没,我想换条路。
from workflow.
from workflow.
Response timeout那个去掉了没?
…
---原始邮件--- 发件人: @.> 发送时间: 2024年5月7日(周二) 晚上7:31 收件人: @.>; 抄送: @.@.>; 主题: Re: [sogou/workflow] workflow充当HTTP网关时数据量太大就收不全 (Issue #1548) http server从外网接收大数据问题已经解决了是吧? 😭没,我想换条路。 — Reply to this email directly, view it on GitHub, or unsubscribe. You are receiving this because you commented.Message ID: @.***>
你说过后我就去掉了
from workflow.
from workflow.
用我们tutorial里的http echo server试过了吗?
…
---原始邮件--- 发件人: @.> 发送时间: 2024年5月7日(周二) 晚上7:59 收件人: @.>; 抄送: @.@.>; 主题: Re: [sogou/workflow] workflow充当HTTP网关时数据量太大就收不全 (Issue #1548) Response timeout那个去掉了没? … ---原始邮件--- 发件人: @.> 发送时间: 2024年5月7日(周二) 晚上7:31 收件人: @.>; 抄送: @.@.>; 主题: Re: [sogou/workflow] workflow充当HTTP网关时数据量太大就收不全 (Issue #1548) http server从外网接收大数据问题已经解决了是吧? 😭没,我想换条路。 — Reply to this email directly, view it on GitHub, or unsubscribe. You are receiving this because you commented.Message ID: @.> 你说过后我就去掉了 — Reply to this email directly, view it on GitHub, or unsubscribe. You are receiving this because you commented.Message ID: @.>
试过了云服务器发200K左右本地不能立刻收到有延迟
from workflow.
from workflow.
这。。。是不是rtt大啊。超过16k的话,因为tcp窗口的原因,会达到数个rtt。延迟是多久?
---原始邮件---
发件人: @.>
发送时间: 2024年5月8日(周三) 凌晨0:36
收件人: @.>;
抄送: @.@.>;
主题: Re: [sogou/workflow] workflow充当HTTP网关时数据量太大就收不全 (Issue #1548)用我们tutorial里的http echo server试过了吗?
…
---原始邮件--- 发件人: @.> 发送时间: 2024年5月7日(周二) 晚上7:59 收件人: @.>; 抄送: @.@.>; 主题: Re: [sogou/workflow] workflow充当HTTP网关时数据量太大就收不全 (Issue #1548) Response timeout那个去掉了没? … ---原始邮件--- 发件人: @.> 发送时间: 2024年5月7日(周二) 晚上7:31 收件人: @.>; 抄送: @.@.>; 主题: Re: [sogou/workflow] workflow充当HTTP网关时数据量太大就收不全 (Issue #1548) http server从外网接收大数据问题已经解决了是吧? 😭没,我想换条路。 — Reply to this email directly, view it on GitHub, or unsubscribe. You are receiving this because you commented.Message ID: @.> 你说过后我就去掉了 — Reply to this email directly, view it on GitHub, or unsubscribe. You are receiving this because you commented.Message ID: @.>试过了云服务器发200K左右本地不能立刻收到有延迟
—
Reply to this email directly, view it on GitHub, or unsubscribe.
You are receiving this because you commented.Message ID: @.***>
怎么看rtt时间呢太底层了,不熟悉
from workflow.
from workflow.
Ping一下啊。。。
---原始邮件---
发件人: @.>
发送时间: 2024年5月8日(周三) 凌晨0:43
收件人: @.>;
抄送: @.@.>;
主题: Re: [sogou/workflow] workflow充当HTTP网关时数据量太大就收不全 (Issue #1548)这。。。是不是rtt大啊。超过16k的话,因为tcp窗口的原因,会达到数个rtt。延迟是多久?
---原始邮件---
发件人: @.>
发送时间: 2024年5月8日(周三) 凌晨0:36
收件人: @.>;
抄送: @.@.>;
主题: Re: [sogou/workflow] workflow充当HTTP网关时数据量太大就收不全 (Issue #1548)用我们tutorial里的http echo server试过了吗?
…
---原始邮件--- 发件人: @.> 发送时间: 2024年5月7日(周二) 晚上7:59 收件人: @.>; 抄送: @.@.>; 主题: Re: [sogou/workflow] workflow充当HTTP网关时数据量太大就收不全 (Issue #1548) Response timeout那个去掉了没? … ---原始邮件--- 发件人: @.> 发送时间: 2024年5月7日(周二) 晚上7:31 收件人: @.>; 抄送: @.@.>; 主题: Re: [sogou/workflow] workflow充当HTTP网关时数据量太大就收不全 (Issue #1548) http server从外网接收大数据问题已经解决了是吧? 😭没,我想换条路。 — Reply to this email directly, view it on GitHub, or unsubscribe. You are receiving this because you commented.Message ID: @.> 你说过后我就去掉了 — Reply to this email directly, view it on GitHub, or unsubscribe. You are receiving this because you commented.Message ID: @.>试过了云服务器发200K左右本地不能立刻收到有延迟
—
Reply to this email directly, view it on GitHub, or unsubscribe.
You are receiving this because you commented.Message ID: @.***>怎么看rtt时间呢太底层了,不熟悉
—
Reply to this email directly, view it on GitHub, or unsubscribe.
You are receiving this because you commented.Message ID: @.***>
有没有别的工具,问题就是ping不通啊
from workflow.
Ping一下啊。。。
---原始邮件---
发件人: @.>
发送时间: 2024年5月8日(周三) 凌晨0:43
收件人: @.>;
抄送: @.@.>;
主题: Re: [sogou/workflow] workflow充当HTTP网关时数据量太大就收不全 (Issue #1548)这。。。是不是rtt大啊。超过16k的话,因为tcp窗口的原因,会达到数个rtt。延迟是多久?
---原始邮件---
发件人: @.>
发送时间: 2024年5月8日(周三) 凌晨0:36
收件人: @.>;
抄送: @.@.>;
主题: Re: [sogou/workflow] workflow充当HTTP网关时数据量太大就收不全 (Issue #1548)用我们tutorial里的http echo server试过了吗?
…
---原始邮件--- 发件人: @.> 发送时间: 2024年5月7日(周二) 晚上7:59 收件人: @.>; 抄送: @.@.>; 主题: Re: [sogou/workflow] workflow充当HTTP网关时数据量太大就收不全 (Issue #1548) Response timeout那个去掉了没? … ---原始邮件--- 发件人: @.> 发送时间: 2024年5月7日(周二) 晚上7:31 收件人: @.>; 抄送: @.@.>; 主题: Re: [sogou/workflow] workflow充当HTTP网关时数据量太大就收不全 (Issue #1548) http server从外网接收大数据问题已经解决了是吧? 😭没,我想换条路。 — Reply to this email directly, view it on GitHub, or unsubscribe. You are receiving this because you commented.Message ID: @.> 你说过后我就去掉了 — Reply to this email directly, view it on GitHub, or unsubscribe. You are receiving this because you commented.Message ID: @.>试过了云服务器发200K左右本地不能立刻收到有延迟
—
Reply to this email directly, view it on GitHub, or unsubscribe.
You are receiving this because you commented.Message ID: @.***>怎么看rtt时间呢太底层了,不熟悉
—
Reply to this email directly, view it on GitHub, or unsubscribe.
You are receiving this because you commented.Message ID: @.***>
我自己再试试吧,您早点休息😁
from workflow.
from workflow.
你connect一下看看多长时间连上也行啊
…
---原始邮件--- 发件人: @.> 发送时间: 2024年5月8日(周三) 凌晨0:52 收件人: @.>; 抄送: @.@.>; 主题: Re: [sogou/workflow] workflow充当HTTP网关时数据量太大就收不全 (Issue #1548) Ping一下啊。。。
---原始邮件--- 发件人: @.> 发送时间: 2024年5月8日(周三) 凌晨0:43 收件人: @.>; 抄送: @.@.>; 主题: Re: [sogou/workflow] workflow充当HTTP网关时数据量太大就收不全 (Issue #1548) 这。。。是不是rtt大啊。超过16k的话,因为tcp窗口的原因,会达到数个rtt。延迟是多久?
---原始邮件--- 发件人: @.> 发送时间: 2024年5月8日(周三) 凌晨0:36 收件人: @.>; 抄送: @.@.>; 主题: Re: [sogou/workflow] workflow充当HTTP网关时数据量太大就收不全 (Issue #1548) 用我们tutorial里的http echo server试过了吗? … ---原始邮件--- 发件人: @.> 发送时间: 2024年5月7日(周二) 晚上7:59 收件人: @.>; 抄送: @.@.>; 主题: Re: [sogou/workflow] workflow充当HTTP网关时数据量太大就收不全 (Issue #1548) Response timeout那个去掉了没? … ---原始邮件--- 发件人: @.> 发送时间: 2024年5月7日(周二) 晚上7:31 收件人: @.>; 抄送: @.@.>; 主题: Re: [sogou/workflow] workflow充当HTTP网关时数据量太大就收不全 (Issue #1548) http server从外网接收大数据问题已经解决了是吧? 😭没,我想换条路。 — Reply to this email directly, view it on GitHub, or unsubscribe. You are receiving this because you commented.Message ID: @.> 你说过后我就去掉了 — Reply to this email directly, view it on GitHub, or unsubscribe. You are receiving this because you commented.Message ID: @.> 试过了云服务器发200K左右本地不能立刻收到有延迟 — Reply to this email directly, view it on GitHub, or unsubscribe. You are receiving this because you commented.Message ID: @.> 怎么看rtt时间呢太底层了,不熟悉 — Reply to this email directly, view it on GitHub, or unsubscribe. You are receiving this because you commented.Message ID: @.> 我自己再试试吧,您早点休息😁 — Reply to this email directly, view it on GitHub, or unsubscribe. You are receiving this because you commented.Message ID: @.***>
Elapsed time: 0.023836986 seconds
connect函数返回时间,说明没问题啊。
from workflow.
Related Issues (20)
- Turkish Character Support on get_parsed_body HOT 5
- Get All Headers of HTTP Request HOT 5
- http请求获取对方应答的数据接口是哪一个 HOT 1
- 能支持mqtt或zmq吗 HOT 1
- http server服务,使用WFGoTask处理请求结束后线程数没有降低 HOT 7
- 机器的连接达到了上限,如何关闭TIME_WAIT连接。 HOT 2
- 请教一个kafka 11错误码的问题 HOT 6
- workflow 如何支持 fast-dds? HOT 1
- http请求不响应问题 HOT 2
- 关于redis sub/pub问题 HOT 12
- workflow自定义协议如何分包发送消息 HOT 5
- 在使用kafka库组件时,突然出现 state=67, errorno= 5003 的错误 HOT 12
- workflow TCP服务端为什么发送数据时主动断开连接 HOT 21
- 在WFHttpServer的一个请求series里调用set_last_task设置一个任务不能成功返回http请求 HOT 5
- 怎样实现与MySQL原生客户端库libmysql相同的预编译相关接口(mysql_stmt_...)的功能 HOT 4
- workflow uds通讯的性能请教 HOT 7
- 在使用kafka库组件时,突然出现 state=67, errorno= 5003 的错误,这个问题重复出现了 HOT 21
- 关于使用kafka创建topic相关问题 HOT 2
- 请教关于任务流和任务调度的两个问题 HOT 17
- 关于tutorial-05-http_proxy的一些问题 HOT 4
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from workflow.