subnet mask calculation source code

Status
Not open for further replies.

DrBudz

Junior Member level 3
Joined
Dec 5, 2011
Messages
28
Helped
0
Reputation
0
Reaction score
0
Trophy points
1,281
Activity points
1,500
Hello,

I have designed ethernet controller, and I am programming pc software to interface the controller via rs232.

In pc software I have fileds to set the IP address of the controller and subnet mask, and then write it to controller via rs 232.
I need source code for Subnet mask calculation.

When I enter IP adress in the fields, I need subnet mask to be generated automatically, just like in windows network properties settings.

When I enter IP address (for example

192.168.1.10

I need subnet mask to be generated automatically:

255.255.255.0

Can someone help with the IP subnet mask calculation?
Does anybody has a source code for this calculation?

Thanks!
 

Status
Not open for further replies.
Cookies are required to use this site. You must accept them to continue using the site. Learn more…