I have seen MANY MANY posts about this topic, but none are quite the same situation as mine, and thus do not pose any solutions that work for me.
What I have: I have a basic echo server example running on a Stellaris LM3S6611. I wrote the example based on code I found here http://www.ultimaserial.com/avr_lwip_tcp.html . I used the 'Raw API Programming example'. That code works fine. I can connect to my board using telnet, from a linux laptop, and send (I defined it this way) capital 'T' characters to toggle an LED on my board, while ALSO echoing back the typed in data (T in this case). What I want: I want to extend this example to send a message over THE SAME socket, when a button is pressed. The problem: I moved my pcb to global scope. I added a button handler with the following code: void API_pushButtonState(void) { int len; strncpy(buf, "button", 6); len = tcp_sndbuf(pcb); tcp_write(pcb, buf, len, TCP_WRITE_FLAG_COPY); tcp_sent(pcb, NULL); tcp_output(pcb); } >From my understanding, and the LOADS of documentation I have read, this should send my message out. This will not work. I have checked with Wireshark. Nothing is being sent out the wire. I can see both messages of the echo request (the msg from the computer to the board, and the echo response from the board to the computer), but nothing when I press my button. I have debugged the code to verify that when I press the button I am indeed entering the function above. I'm assuming my misunderstanding is with tcp_sndbuf. It always returns 0 when called from this function. I can't decide if the debugger is just lying to me, or if it actually is 0. If I call tcp_sndbuf at startup, I get some massive number (like 26285 or something). If I check the disassembly window DURING the call to this function, it looks to me like when the tcp_sndbuf function gets called, its literally two assembly instructions that move a constant value of 0 into a register used for the length variable. Im baffled. Do I have something set up improperly with lwipopts.h? What am I missing? This email, and any document attached hereto, may contain confidential and/or privileged information. If you are not the intended recipient (or have received this email in error) please notify the sender immediately and destroy this email. Any unauthorized, direct or indirect, copying, disclosure, distribution or other use of the material or parts thereof is strictly forbidden. _______________________________________________ lwip-users mailing list [email protected] https://lists.nongnu.org/mailman/listinfo/lwip-users
