What is the relation of the 'domain' parameter of the 'socket' function with the "data link" layer?

32 Views Asked by At

I am reading UNIX® Network Programming Volume 1, Third Edition: The Sockets Networking API, and on page 1.7 OSI Model, the authors introduce the "OSI model" and the equivalent "Internet protocol suite".

Looking at the man page for socket(2), I understood that the domain parameter is used to choose the "network" layer, and the type parameter defines the "transport" layer.

If that understanding is correct, what if I use AF_BLUETOOTH on a Wifi data link? I imagine it will not connect to the destination endpoint. So, the programmer must know in advance the data link, in order to set the domain parameter correctly? If he/she uses other BSD functions in order to discover the available data links, how he/she will know which domain value to use? Is there a way to know, while the program is running, which type should be used, based on the data link?

0

There are 0 best solutions below