J
J
JustTeapot2017-05-29 13:32:54
Network administration
JustTeapot, 2017-05-29 13:32:54

Why the necessary bind function?

I read about sockets.
I see the bind function.
The description says that "the bind function is needed to bind a local address to a socket".
Ahem. What for?
There is a computer, the computer has an address. Why can't the stack somehow itself bind the address it knows to the socket?
Or is it necessary for computers that have two network cards / two addresses?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
J
jcmvbkbc, 2017-05-29
@JustTeapot

The description says that "the bind function is needed to bind a local address to a socket".
Ahem. What for?
There is a computer, the computer has an address. Why can't the stack somehow itself bind the address it knows to the socket?

Therefore, "address" is not only an IP address, but also a port (TCP and UDP), or a path in the file system (UNIX domain sockets) or whatever for other protocols.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question