26.12.2013 Views

lwIP - A Minimal TCP/IP implementation - Wikia

lwIP - A Minimal TCP/IP implementation - Wikia

lwIP - A Minimal TCP/IP implementation - Wikia

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

16 NETWORK CONNECTION FUNCTIONS<br />

Description<br />

The function netconn_peer() is used to obtain the <strong>IP</strong> address and port of the remote end of a<br />

connection. The parameters addr and port are result parameters that are set by the function. If<br />

the connection conn is not connected to any remote host, the results are undefined.<br />

16.0.18 netconn addr()<br />

Synopsis<br />

int netconn addr(struct netconn *conn,<br />

struct ip addr **addr, unsigned short port)<br />

Description<br />

This function is used to obtain the local <strong>IP</strong> address and port number of the connection conn.<br />

16.0.19 netconn bind()<br />

Synopsis<br />

int netconn bind(struct netconn *conn,<br />

struct ip addr *addr, unsigned short port)<br />

Description<br />

Binds the connection conn to the local <strong>IP</strong> address addr and <strong>TCP</strong> or UDP port port. If addr is<br />

NULL the local <strong>IP</strong> address is determined by the networking system.<br />

16.0.20 netconn connect()<br />

Synopsis<br />

int netconn connect(struct netconn *conn,<br />

struct ip addr *remote addr, unsigned short remote port)<br />

Description<br />

In case of UDP, sets the remote receiver as given by remote_addr and remote_port of UDP<br />

messages sent over the connection. For <strong>TCP</strong>, netconn_connect() opens a connection with the<br />

remote host.<br />

16.0.21 netconn listen()<br />

Synopsis<br />

int netconn listen(struct netconn *conn)<br />

Description<br />

Puts the <strong>TCP</strong> connection conn into the <strong>TCP</strong> LISTEN state.<br />

16.0.22 netconn accept()<br />

Synopsis<br />

struct netconn * netconn accept(struct netconn *conn)<br />

Description<br />

Blocks the process until a connection request from a remote host arrives on the <strong>TCP</strong> connection<br />

conn. The connection must be in the LISTEN state so netconn_listen() must be called prior<br />

to netconn_accept(). When a connection is established with the remote host, a new connection<br />

structure is returned.<br />

26

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!