locked
The source port of a sent UDP packet does not equal to the port the socket has binded

    Question

  • There is a problem related to Datagram Socket in WinRT: The source port of a sent UDP packet does not equal to the port the socket has binded. Detail:

    1. Bind a Datagram socket S to port Pb

    2. Send a UDP packet to socket S

    3. But the UDP source port of the sent packet does not equalt to Binded port Pb

    Question: Is there any way to designate the source port when sending a UDP packet so that the source port will equal to Pb?

    Thanks.


    Friday, August 10, 2012 4:57 PM

Answers

  • There is nothing wrong in the API. It is just a bug in my code, which creates a new DatagramSocket every time it sends a packet, causing implicit bind.
    • Marked as answer by Renjie Huang Thursday, August 30, 2012 6:50 PM
    Thursday, August 30, 2012 6:50 PM

All replies

  • This appears to be a bug in my code.
    Friday, August 10, 2012 10:02 PM
  • Hello,

    Would you please provide us the whole codes to reproduce this issue,

    You can upload your project to skydriver
    http://skydrive.live.com/

    It is not necessary that you send out the whole of your project. We just need a simplest sample to reproduce the problem. You can remove any confidential information or business details from it.

    Best regards,
    Jesse


    Jesse Jiang [MSFT]
    MSDN Community Support | Feedback to us

    Monday, August 13, 2012 11:28 AM
  • There is nothing wrong in the API. It is just a bug in my code, which creates a new DatagramSocket every time it sends a packet, causing implicit bind.
    • Marked as answer by Renjie Huang Thursday, August 30, 2012 6:50 PM
    Thursday, August 30, 2012 6:50 PM