客户端未收到套接字服务器回复 [英] socket server reply not received by client

查看:104
本文介绍了客户端未收到套接字服务器回复的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已经编写了一些代码来在计算机B上的应用程序中创建服务器套接字(使用Winsock).

我没有编写在计算机A上运行的客户端应用程序.它连接到我的服务器套接字(可以在我的代码中看到),然后尝试通过已创建的套接字连接将一些数据发送回客户端.

我在B上的方法告诉我已经发送了字节,但是客户端似乎没有接收到它.有什么明显的理由(对我而言不是)吗?

我没有使用插座太多或很长时间了.我使用了该网站上的一些预先编写的代码来使自己着手工作,除在A上外,其他一切看起来都很好.

I have written some code to create a server socket (using winsock) in an application on machine B.

There is a client app running on machine A that I did not write. It connects to my server socket (I can see this in my code), and then I attempt to send some data back to the client on the socket connection that has been created.

My method on B tells me that bytes have been sent, but the client does not appear to receive it. Is there any obvious (but not to me) reason why this might be?

I havn''t used sockets much or for a very long time. I used some pre-written code from this web-site to get myself going, and it all appears fine except on A.

推荐答案

尝试使用Wireshark [ ^ ]-这将告诉您是否确实有任何内容传递给客户端应用程序.

否则,您将不得不显示一些代码...

最好的问候
Espen Harlinn
Try using Wireshark[^] - this will tell you if anything is actually passed to the client application.

Otherwise you''ll have to show a bit of your code ...

Best regards
Espen Harlinn


由于您没有编写客户端软件,因此您是否具有规范或至少有一个文档描述客户端和服务器软件之间要通过的协议?

套接字通信是在客户端程序和服务器程序之间达成的协议数据传输.您暗示您将通过发送数据立即响应连接.您确定客户端软件正在预期这种行为还是正在发送数据(例如命令/响应协议)?客户端软件可能不是从套接字的末端读取数据,而是发送给您.

您有什么证据表明客户未收到您的数据?您是否期望它会随着您发送的数据产生一些输出?

无论如何,很难诊断出数据没有到达另一端的许多原因.最常见的错误是所涉及的两个程序的期望不匹配.除非您可以隔离并发布客户端和服务器软件的相关部分,否则您将不得不使用在其他地方建议的外部嗅探工具.
Since you did not write the Client software, do you have the specifications on it or at least a document describing the protocol to be passed between the client and your server software?

Socket communication is an agreed upon transfer of data between a client and server programs. You imply that you immediately respond to the connection by sending data. Are you sure the client software is expecting this behavior or is it also sending data (like a command / response protocol)? The client software may not be reading data from its end of the socket but sending to you instead.

What evidence do you have that the Client has not received your data? Were you expecting some output that it produces with the data you sent?

In any event, it is hard to diagnose the many reasons why your data did not get to the other side. The most common error is a mismatch in the expectations of the two program involved. Unless you can isolate and post the relevant pieces of both the client and server software, you will have to resort to external sniffing tools as suggested elsewhere.


这篇关于客户端未收到套接字服务器回复的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆