- Fri May 08, 2015 11:14 am
#16914
I started some work on it, but finally took a completely other approach. I couldn't make heads nor tails of the code. That's not your fault, I blame the esp guys. They really don't seem to know how to write decent and readable code. I really hope the closed/proprietary code is of a higher standard than this code.
So I threw everything away and started from scratch. Every feature was thrown out and every line that's not necessary was also thrown out. I now have a project of 1 directory, 8 files (from which 1 is actual source), 217 lines of c code in total. And it works. The makefile now also works, it only compiles files that have changed and depend on it. The baud rate and the ap parameters must be hardcoded, there is no interface to flash, I don't see the point.
The max number of tcp connections is also hard coded now, as a matter of fact, with the current code it's not even possible to serve more than one connection. I don't see the need for multiple connections for my application.
What's interesting is, is that if you set the max number of tcp connections to "1", the esp doesn't send a RST (connection reset) but simply doesn't answer when there is already a connection. The con is that the second connecting party doesn't know it can't connect immediately, the pro is that if the first connecting party leaves pretty quick, the second will connectly automatically.
I think this version is much more suitable for extension with some features.
For those who'd like to take a look:
https://github.com/eriksl/esp8266-basic-bridge