I have a socket server (written on C++) which receives requests from clients and sends responses back. So, my test client application (C#) is very simple:
        try {
            UdpClient udpClient = new UdpClient(10241);
            // Connect
            udpClient.Connect(server_ip_address,  10240);
            // prepare the packet to send
            iWritableBuff wbuff = new iWritableBuff();
            [ ... ]
            // Send 
            udpClient.Send(wbuff.GetBuff(), (int)wbuff.Written());
            // Receive a response
            IPEndPoint RemoteIpEndPoint = new IPEndPoint(IPAddress.Any, 0);
            Byte[] receiveBytes = udpClient.Receive(ref RemoteIpEndPoint); 
            Console.WriteLine("We've got some data from the server!!! " + receiveBytes.Length + " bytes.");
            udpClient.Close();
        } catch (Exception e) {
            Console.WriteLine("ERROR: " + e.ToString());
        }
I run both applications on the same computer. Server receives a request to port 10240 from the client port 10241 and sends a response back to client port 10241, but client never receive it. So, I'm sure that server sends packet back, because everything works perfectly with C++ client. It means that I'm, doing something wrong on my C# client. Any idea?
Thanks!
P.S.> Just test it with Berkley Socket C# client:
        try {
            // Create socket
            Socket s = new Socket(AddressFamily.InterNetwork, SocketType.Dgram, ProtocolType.Udp);
            // Bind
            IPEndPoint myEP = new IPEndPoint(IPAddress.Any, 0);
            s.Bind(myEP);
            // prepare the packet to send
            iWritableBuff wbuff = new iWritableBuff();
            [ ... ]
            // Send it
            IPEndPoint sEP = new IPEndPoint(IPAddress.Parse(server_ip_address), 10240);
            int res = s.SendTo(wbuff.GetBuff(), (int)wbuff.Written(), 0, sEP);
            // Receive the response
            byte[] receiveBytes = new Byte[1024];
            EndPoint recEP = new IPEndPoint(IPAddress.Any, 0);
            res = s.ReceiveFrom(receiveBytes, ref recEP);
            Console.WriteLine("We've got some data from the server!!! " + res + " bytes.");
        } catch (Exception e) {
            Console.WriteLine("ERROR: " + e.ToString());
        }
And it works perfect! What's is wrong with UdpSocket?