C#
An object-oriented and type-safe programming language that has its roots in the C family of languages and includes support for component-oriented programming.
11,559 questions
This browser is no longer supported.
Upgrade to Microsoft Edge to take advantage of the latest features, security updates, and technical support.
I want to create a raw socket and bind it to the specified port, but it is always bound to port 0. Why?
Here's my code.
{
Socket receiveSocket = new Socket(AddressFamily.InterNetwork, SocketType.Raw, ProtocolType.Raw);
receiveSocket.Bind(new IPEndPoint(IPAddress.Parse("10.21.1.101"), 20000));
}