"Vardhan, Sundara (GE Infra, Energy)" <sundara.vardhan@xxxxxx> writes: > Is there any way to access netmask given the IP address from within > c program. I have an ip address for which I need to get the netmask > and broadcast addresses and also set route for them. Your help will > be greatly appreciated. This is not a question about gcc. This is a question about the specific operating system that you are using. You should direct this type of question to a mailing list for your operating system. That said: these days it doesn't make sense to ask for the netmask and broadcast address of an arbitrary IP address. The only way to know that information is to ask a machine running the local net that the IP address is on. If you happen to be using GNU/Linux or a Unix variant, I recommend getting the book "Unix Network Programming." It will tell you what you need to know about this sort of question. Ian