afnid / espsim

ESP8266 Simulator (Allows Native Code to Link/Run on Linux)
GNU General Public License v2.0
65 stars 12 forks source link

tcp client #2

Open st0ff3r opened 6 years ago

st0ff3r commented 6 years ago

Hi, i am trying to use espsim to test libmqtt, but I am running into a problem about how to start the networking. On the esp8266 hardware I would call espconn_gethostbyname() and do espconn_connect() in the callback.

Should I just setup the espconn connection struct myself and call espconn_connect()?

Do you have any example how you start the networking?

afnid commented 6 years ago

I didn't have any different code to setup the networking in all of my esp sources. My application would have made the wifi connect calls and then made the espconn calls after that, just enough in the wifi was stubbed out to make it bootstrap and run.

I was running on a host on my physical lan and participating as a peer with other esp8266 devices on my wireless lan. I have no idea if anybody else has ever gotten this to work, it is a pretty specialized use case, but it was worth it in my case.

I didn't do much more than a simple stand-alone startup but I got my code to compile and link again. I think I was on a 1.X sdk before and now tested with 2.1.0-18. So cleaned up several conflicts and added a couple more functions. Again, not tested, mileage will vary.