0

I'm gonna use Socket() constructor to create a dummy like socket.

what is the difference of using bind() and connect() to this created socket?

if i'm gonna use bind() how can i establish connection or does it directly establish connection?

1 Answer 1

1

With a socket you build a connection between two endpoints. One of these endpoints (the local one) is on your machine, the other endpoint (the remote one) may be anywhere.

With bind you set the address of the local endpoint. Often you don't need to do that, since your operating system will take care of the details.

With connect you set the address of the remote endpoint and start a connection.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.