   getaddrinfo in udp returns address of 0.0.0.0
  I want to create a socket and do a bind on my local pc.I call getaddrinfo like this:getaddrinfo(NULL, "0", &hints,  &serverinfo);with hints ai_family = AF_INET, socktype=SOCK_DGRAM and ai_flags = AI_PASSIVE.when I look at serverinfo[0].ai_addr and do some converting I get the ip address to be 0.0.0.0 and portnumer=0 as well. Shouldn't they contain my pc's ip address and a new port number ?   
  Conceptually, there is no such thing as your PC's unique IP address. Typically, every PC has at least two network interfaces, e.g. ethernet and loopback. The IP address associated with the ethernet interface is what you probably think of as "your PC's IP address" and could be something like 192.168.x.x if you are behind a typical NAT setup. The IP address associated with the loopback interface is 127.0.0.1.Now getaddrinfo() tells you to use 0.0.0.0 when bind()-ing, which is probably what you want, because it tells the socket to listen to all available network interfaces. If you want to implement some access control and only let people connect from a specific network interface, you would pass that interface's IP address to bind().Finally, when bind()-ing a UDP socket with port number 0, the system will automatically assign a free port number for you, which is probably what you want (unless you need a fixed port number, of course).Hope that clears up your questions.   