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?)
This is just from a brief reading of the code:
- Do not bind to
127.0.0.1
. Bind toIPAddress.Any
instead. OnDataReceivedFromServer
needs to callEndReceive
.- I don't recommend mixing synchronous (
Send
) and asynchronous (BeginReceive
) operations on the same socket.
精彩评论