views:

51

answers:

1

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: http://stackoverflow.com/questions/3232125/why-cant-i-send-to-the-listening-socket-anymore)

A: 

This is just from a brief reading of the code:

  1. Do not bind to 127.0.0.1. Bind to IPAddress.Any instead.
  2. OnDataReceivedFromServer needs to call EndReceive.
  3. I don't recommend mixing synchronous (Send) and asynchronous (BeginReceive) operations on the same socket.
Stephen Cleary