I have created a tcp server using lwip on a TM4C1294XL dev kit. I have noticed most of the examples on this forum and elsewhere create a global tcp_pcb struct. Reading the comments in the lwip files and examining the code seems to indicate that I don't need to do that though. tcp_new() looks like it creates a new pcb, and tcp_close() seems to free up the pcb.
To see if the global struct was being used, I tried referencing the global tcp_pcb struct after a connection was established. When I tried to send data I received an error that the connection was not connected, which would seem to indicate it isn't being used.
Am I missing something, or do we not need to declare tcp_pcb globally?