用户调用bind()时,实际调用的是lwip_bind(),我们从这个函数看起: 1int2lwip_bind(ints,conststructsockaddr *name, socklen_t namelen)3{4...5sock = get_socket(s);//根据socket()函数返回的socket号取得socket在lwip中的完整结构体6if(!sock)7return-1;8...9local_addr.addr = ((conststructsockadd...
* @param port the local port to bind to * @return ERR_USE if the port is already in use * ERR_OK if bound 成功绑定 */ err_t tcp_bind(struct tcp_pcb *pcb, struct ip_addr *ipaddr, u16_t port) { struct tcp_pcb *cpcb; LWIP_ERROR("tcp_connect: can only bind in state CLOSED...
>> if*(lwip_bind*(socket_fd, (struct sockaddr *) &ra, sizeof(ra)) == -1) >> { >> lwip_close(socket_fd); >> *DisplayString(115, 190 - 10, " bind error... ");*//Display >> message on LCD in LM3S9B96 >> } >> >> while(1) >> { >> >> //receive from server >...