Is bind() mandatory for a stream TCP connection?

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Is bind() mandatory for a stream TCP connection?

Jump to solution
621 Views
lucky06200
Contributor II

Hello,

I send a TCP frame with :

  1. socket()
  2. connect()
  3. send()
  4. shutdown()

Is this path OK, or is it needed to add a bind() between socket and connect ?

Thank you for attention.

Labels (1)
Tags (5)
0 Kudos
Reply
1 Solution
485 Views
susansu
NXP Employee
NXP Employee

Hi,

Yes you need add a bind() before connect to assign the port number, address and protocol  the socket use , so that the socket could receive the other end's reply.

View solution in original post

0 Kudos
Reply
1 Reply
486 Views
susansu
NXP Employee
NXP Employee

Hi,

Yes you need add a bind() before connect to assign the port number, address and protocol  the socket use , so that the socket could receive the other end's reply.

0 Kudos
Reply