Is bind() mandatory for a stream TCP connection?

取消
显示结果 
显示  仅  | 搜索替代 
您的意思是: 
已解决

Is bind() mandatory for a stream TCP connection?

跳至解决方案
480 次查看
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 解答
344 次查看
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 回复
345 次查看
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 项奖励