为什么没有将所有数据包发送到客户端?
我正在用 C# 为在线游戏编写一个简单的代理(更多的是数据包记录器)。所有数据包都被代理接收,但有些数据包没有发送到客户端(不确定服务器)。 例如:
客户端->服务器:登录数据包 - 我的代理接收数据包,显示它并将其发送到服务器。
服务器->客户端:已连接!数据包 - 我的代理再次收到数据包,它也显示它并将其发送到客户端。
服务器->客户端:聊天通道数据包 - 我的代理再次收到数据包,它也显示它,但客户端没有收到它。也不例外。
我的代码: http://lesderid.pastebin.com/Km7vT2jF
(这是与此处相同的项目: 为什么我不能再发送到监听套接字?< /a>)
I'm writing a simple proxy (more a packet logger) for an online game in C#. All the packets get received by the proxy but some aren't sent to the client (not sure about the server).
For example:
Client->Server: Login Packet - My proxy receives the packet, displays it and sends it to the server.
Server->Client: Connected! Packet - My proxy again receives the packet, it also displays it and sends it to the client.
Server->Client: Chat channels packet - My proxy again receives the packet, it also displays it but the client doesn't receive it. There is no exception.
My code: http://lesderid.pastebin.com/Km7vT2jF
(This is the same project as here: Why can't I send to the listening socket anymore?)
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
这只是对代码的简要阅读:
127.0.0.1
。改为绑定到IPAddress.Any
。OnDataReceivedFromServer
需要调用EndReceive
。Send
) 和异步 (BeginReceive
) 操作。This is just from a brief reading of the code:
127.0.0.1
. Bind toIPAddress.Any
instead.OnDataReceivedFromServer
needs to callEndReceive
.Send
) and asynchronous (BeginReceive
) operations on the same socket.