Is bind() mandatory for a stream TCP connection?

キャンセル
次の結果を表示 
表示  限定  | 次の代わりに検索 
もしかして: 

Is bind() mandatory for a stream TCP connection?

ソリューションへジャンプ
478件の閲覧回数
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.

ラベル(1)
タグ(5)
0 件の賞賛
1 解決策
342件の閲覧回数
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 件の賞賛
1 返信
343件の閲覧回数
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 件の賞賛