Hi,
I imported the uip example from the Tiva Ware Library which creates a mini webserver that provides a simple website with an counter that increments each time you refresh the page. I was also able to to create an additional second server which listens on port 8080. Together with netcat I can use it like a serial console.
But now I want to use this connection to send data from an other part of my code. Normally you have to wait inside the *_appcall callback until new data has arriveed using 'uip_newdata()' and then you can send send data back. But I want to send data to the cliente without waiting for new data. I found out that there is an array named 'uip_conns' inside 'uip.c':
struct uip_conn uip_conns[UIP_CONNS];
It stores all connections which are present at a time. The pointer 'struct uip_conn *uip_conn' is always set to the current connection inside the' *_appcall' callback and all uip functions like 'uip_connected()', 'uip_poll()', 'uip_newdata', 'uip_acked()', etc. are using this pointer. If I do not close the connection with 'uip_close()' I would be able to send as much data as I want. But only inside the callback. But I want also to be able to send data to that connection outside of the callback. Is it possible to set the pointer 'uip_conn' to a certain connection and then use 'uip_send()' from outside? Or do I have to implement a kind of ring buffer in which I store the bytes I want to send next and then reading from that buffer inside the '*_appcall' callback to send the data to the connection?
For example. I have a main loop which accumulates samples from an A/D converter and after each conversion I want to send the data directly through the connection on port 8080 to the client.
Further information about the hardware: I am using the Tiva™ C Series Connected Launchpad EK-TM4C1294XL. I am programming in CCS 6.0.1.00040 under Ubuntu 14.04.1 LTS x64 with the TI compiler.