Accept()在服务器上的调用成功,但是Connect()call on Client on tagin file file ving forror code 10035

发布于 2025-02-13 02:36:05 字数 188 浏览 0 评论 0原文

我有一个以非阻止模式运行的客户端服务器模型,在该模式下,服务器像往常一样尝试无限地接受连接。客户端正在反复尝试与服务器连接,直到成功为止。 ,我可以在服务器上看到accept()调用成功的登录

当我首先运行服务器然后客户端时 这和其中发生了很多事情。服务器&客户实际上是数据包嗅探器,问题是当我尝试在这2个嗅探器之间建立连接以传输信息时。

I've a client server model operating in non blocking mode where the server is as usual trying to accept connections infinitely. And client is repeatedly trying to connect with the server until it succeeds.
When I run the server first and then client, I can see logs on server that the accept() call was a success but on client side the connect() call is failing with an error code 10035.

Overall files are a lot bigger than than this and there's so much going on in them. Both server & client are actually packet sniffers and the problematic part is when I try to establish a connection between these 2 sniffers to transfer information.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

沫尐诺 2025-02-20 02:36:05

错误代码10035是wsaewouldblock(),这意味着连接没有失败 - 它尚未完成,您需要等一下。

通常,一个人会等到插座写在写作或发出返回该代码的连接后具有错误条件 - 一旦发生了这两件事,您就会知道该连接已由于某些其他原因完成或失败。您可以使用a 选择 使用“写入FDS”和“除外”参数中包含的描述符调用。

Error code 10035 is WSAEWOULDBLOCK (table), which means the connection did not fail -- it just hasn't completed yet, and you need to wait a bit.

Normally one will wait until the socket is writable or has an error condition after issuing a connect that returns this code -- once one of those two things happen, you know the connection has either completed or failed for some other reason. You can do that wait with a select call with the descriptor included in 'writefds' and 'exceptfds' arguments.

要走干脆点 2025-02-20 02:36:05

根据我的说法,Connect()需要一些时间才能建立连接,因此您不能以非阻止模式运行它。服务器在Accept()中没有显示错误是由于以下原因:
3道握手:
客户端将SYN标志发送到服务器
服务器用Syn-Ack响应,当服务器确认时,它会从Accept()返回成功
但是,要完成三道握手,客户端必须将ACK发送回服务器,而该服务器由于非阻止模式而无法执行,因此Connect()失败了。

According to me connect() takes some time to establish a connection thus you cannot have it running in non blocking mode. And server is showing no error in accept() is because of the following reason:
3 way handshake:
Client sends SYN flag to the server
And server responds with SYN-ACK and when server acknowledges, it returns success from accept()
BUT, to complete 3 way handshake, client must send an ACK back to the server which it fails to do because of non blocking mode, thus connect() fails.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文