Hi there lwip users, I've had success sending UDP packets on demand, but am not finding success doing the same with a TCP Connection.
For now I'm just implementing a base case inside a function that I call after lwip_init to try to get it working. What I'm wanting in the end is to have a function I can call with an IP and data to send to it. Here's what I've got now. void echo_tx_tcp() { volatile int dumb = 0; err_t wr_err = ERR_OK; struct tcp_pcb *l_tcp_pcb; l_tcp_pcb = tcp_new(); ip_addr_t dest_ip = { ((u32_t)0x0C0C0C2BUL) }; wr_err = tcp_bind(l_tcp_pcb, &dest_ip, 12); if (wr_err == ERR_OK) { dumb +=1; } wr_err = tcp_connect(l_tcp_pcb, &dest_ip, 12, echo_accept); if (wr_err == ERR_OK) { dumb +=1; } tcp_sent(l_tcp_pcb, echo_sent); struct pbuf *pl = pbuf_alloc(PBUF_TRANSPORT, 1024, PBUF_RAM); unsigned char buffer_send[1024] = "My Name Is Mitch TCP"; pl->payload = buffer_send; pl->len = 1024; pl->tot_len = 1024; wr_err = tcp_write(l_tcp_pcb, pl->payload, pl->len, 1); if (wr_err == ERR_OK) { dumb +=1; } wr_err = tcp_output(l_tcp_pcb); if (wr_err == ERR_OK) { dumb +=1; } return; } The "dumb" variable is just to force the compiler to not skip the wr_err assignement, which I'm monitoring using a debugger. What I've found is that wr_err is ERR_OK up until the tcp_write command after which it is -1 (ERR_MEM). I'm using a NXP processor and their canned demo, I do not see a buffer length function in there. Nonetheless, that is where I stand, and I'm in need of some advice as to what might be wrong. Regards, Mitch Jones
_______________________________________________ lwip-users mailing list lwip-users@nongnu.org https://lists.nongnu.org/mailman/listinfo/lwip-users