[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[lwip-devel] [task #10155] TCP Connect from netconn Interface without bl
From: |
Simon Goldschmidt |
Subject: |
[lwip-devel] [task #10155] TCP Connect from netconn Interface without blocking |
Date: |
Fri, 05 Feb 2010 12:12:15 +0000 |
User-agent: |
Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10.6; de; rv:1.9.2) Gecko/20100115 Firefox/3.6 |
Update of task #10155 (project lwip):
Status: None => Done
Percent Complete: 0% => 100%
Open/Closed: Open => Closed
Planned Release: None => 1.4.0
_______________________________________________________
Follow-up Comment #1:
This is already implemented in CVS HEAD, although using it from the socket
API is easier than from the netconn API.
With the socket API:
- int opt = 1;
- lwip_ioctl(sock, FIONBIO, &opt);
- lwip_connect(sock, ...) -> does not block (only a short time for threading
synchronization into tcpip_thread)
- use lwip_select() to wait for the socket to get writable (connected) or
have an error (connect failed)
You can use this from the netconn API, too, however you have to create your
own callback function that handles the netconn_evt events:
- conn = netconn_new_with_callback(NETCONN_TCP, your_callback_function)
- netconn_set_nonblocking(conn, 1)
- netconn_connect(...) -> does not block (as above)
- wait for your_callback_function() to be called with event
NETCONN_EVT_SENDPLUS (connected) or NETCONN_EVT_ERROR (connect failed)
Watch out for threading: the callback is called in tcpip_thread, not in your
application thread.
I don't think it's necessary to create a framework here (like select is for
sockets - that one is pretty bloated, anyway).
I've also added this description to the wiki.
_______________________________________________________
Reply to this item at:
<http://savannah.nongnu.org/task/?10155>
_______________________________________________
Nachricht geschickt von/durch Savannah
http://savannah.nongnu.org/