MCPcopy Create free account
hub / github.com/RT-Thread/rt-thread / netconn_bind

Function netconn_bind

components/net/lwip/lwip-1.4.1/src/api/api_lib.c:165–181  ·  view source on GitHub ↗

* Bind a netconn to a specific local IP address and port. * Binding one netconn twice might not always be checked correctly! * * @param conn the netconn to bind * @param addr the local IP address to bind the netconn to (use IP_ADDR_ANY * to bind to all addresses) * @param port the local port to bind the netconn to (not used for RAW) * @return ERR_OK if bound, any other err_t on

Source from the content-addressed store, hash-verified

163 * @return ERR_OK if bound, any other err_t on failure
164 */
165err_t
166netconn_bind(struct netconn *conn, ip_addr_t *addr, u16_t port)
167{
168 struct api_msg msg;
169 err_t err;
170
171 LWIP_ERROR("netconn_bind: invalid conn", (conn != NULL), return ERR_ARG;);
172
173 msg.function = do_bind;
174 msg.msg.conn = conn;
175 msg.msg.msg.bc.ipaddr = addr;
176 msg.msg.msg.bc.port = port;
177 err = TCPIP_APIMSG(&msg);
178
179 NETCONN_SET_SAFE_ERR(conn, err);
180 return err;
181}
182
183/**
184 * Connect a netconn to a specific remote IP address and port.

Callers 1

lwip_bindFunction · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected