delay_ms is used throughout our bare metal implementation I can guarantee it's not blocking. tcp_cb_called is called to the registered callback function yes. And sure, main loop as you suggest is functional as well yes. However I fail see why LWIP layer marks SYN_SENT state in pcb but I cannot see the packet's being transmitted/received on the datalink itself? LWIP doesn't signal any failures has been made during the process except the abort at error callback when the timeout is reached.
________________________________________ From: lwip-users [lwip-users-bounces+inderjit.singh=evidente...@nongnu.org] on behalf of Sergio R. Caprile [scapr...@gmail.com] Sent: 04 June 2018 16:58 To: lwip-users@nongnu.org Subject: Re: [lwip-users] tcp_connection (no SYN packet on server side) That may or may not work depending on what your _magic function_ "delay_ms" does. If it is blocking, you are busted. A main loop is a main loop, you need to rx and you need to check timeouts. Your accept callback will be called after the SYN is SYNACKed and the SYNACK is ACKed back. For that, you need to have the stack running, otherwise no one can send anything, and that is done by calling sys_check_timeouts() as frequently as you can. And you need to rx for the SYNACK, which is done by calling ethernetif_input() frequently enough in order not to lose frames. That can't happen if you are blocking. If you really want to sequentially check for whatever reason, you can do this: udp_cb_called = tcp_cb_called = false; IP4_ADDR(&ip, ETH_CONF_IPADDR0, ETH_CONF_IPADDR1, ETH_CONF_IPADDR2, 155); err = tcp_connect(pcb_tcp, &ip, ETH_TCP_PORT_REM, tcp_connected_cb); if (err != ERR_OK) { // Oops } while(udp_cb_called == false && tcp_cb_called == false) { ethernetif_input(&dev_netif); sys_check_timeouts(); } Your second attempt to call connect will fail as your pcb is being used, so that won't work inside a loop (and a bit involved to explain in one line). And I guess you'll set tcp_cb_called to "true" somewhere in your tcp_connected_cb() However, that is not much different from a real main loop: while(1) { ethernetif_input(&dev_netif); if(whatiamexpectinghashappened) ; // bingo! sys_check_timeouts(); world_save(); stuff_do(); morestuff_moredo(); } _______________________________________________ lwip-users mailing list lwip-users@nongnu.org https://lists.nongnu.org/mailman/listinfo/lwip-users _______________________________________________ lwip-users mailing list lwip-users@nongnu.org https://lists.nongnu.org/mailman/listinfo/lwip-users