Three definitions:
Int inet_aton (const char * CP, struct in_addr * indium );
In_addr_t inet_addr (const char * CP );
In_addr_t inet_network (const char * CP );
Three differences:
Let's talk about the difference first. But in fact, this is not good, because I am afraid that you will not practice it because you know the conclusion. (You don't, do you? ^_^)
On the paper, you may have to learn more about it.
The inet_addr and inet_network functions are used to convert the string form to the integer form. The difference between the two is very small. The integer form returned by inet_addr is the network byte order, while the integer form returned by inet_network is the host byte order. (You will be wondering why the function is called inet_network, but the returned host byte order. Haha, that's so strange. What can you do ...) There is no difference between the two in other places. Both of them have a small defect, that is, when the IP address is 255.255.255.255, these two "boys" (for the nicknames of these two functions, please forgive me... Ipv_^) will regard this as an invalid IP address, which is a legacy problem. In fact, this 255.255.255.255 IP address is valid on most routers.
The difference between the inet_aton function and the above two boys is that he thinks the 255.255.255.255 function is valid and he will not blame this seemingly Special IP address. Therefore, we recommend that you support this function a lot. The two boys should use it less as well :) by the way, the inet_aton function returns the IP address in the byte sequence of the network.
Well, the difference is that simple, as long as you can dive down for five minutes, it will be OK. Oh, forget, what is network byte order and host byte order? If you are not familiar with these two concepts, you 'd better find a book on socket programming. I promise you will understand these two concepts in less than five minutes.