Sunday 15 September 2013

c# - UDP Socket Bind Any IP? (Wildcard - Particular) -


I am working on a socket project and now I will make the UDP audience for server-side. I have seen some examples and I can not understand it; Why do we have to lock the "socket" like the UDP socket. Bund (New IPPpoint ( IP Address, Anyone , 3000)) "?": In TCP socket, we only compel our local IP but in the UDP socket, we are complying with the IPadation. Why are we doing this?

Edit: What are wildcards and special IP addresses? How can we use them?

I found this and I think I was looking for it :)

Wildcard is a special local IP address, it usually means "any" and can only be used for bind operation.

The value of this IP address is 0.0. 0.0. If you have two network adapters, one of IP address 1.1.1.1 and IP address 2.2.2.2, then you can create a loading socket and bind it in 1.1.1.1 so that the socket 2.2 Can not be divided into.2.2 You can also make a golden socket They are able to bind it in 2.2.2.2 so that it will not tie 1.1.1.1 If you do not care for your socket and want to bind all the network cards, then you can tie it on the wildcard address Take it.

Another special value will be 127.0.0.1, which means that only clients connect to their servers on the same computer.

link:

No comments:

Post a Comment