-->
Page 1 of 3

What to replace "conn:send" with?

PostPosted: Fri Feb 05, 2016 11:28 pm
by Trickuncle
After a month or so pause, I'm back at it and finding that code that used to work seems broken some how. Only one or two lines work when using conn:send method.

Then I searched and found this:
http://www.esp8266.com/viewtopic.php?f=18&t=7208&p=39746&hilit=conn%3Asend#p39675

I originally was using "buf = buf.."some text" etc. and then client:send(buf); but it caused random errors. Someone on the forum here suggested using conn:send and that worked fine. But apparently it no longer works. Lines of code that worked fine if using conn:send method throw errors when using the send(buf) method.

Any suggestions???

Re: What to replace "conn:send" with?

PostPosted: Mon Feb 08, 2016 9:04 am
by AdrianM
You have to buffer up you send data and release it from within the <on("sent"> function callback.
this link has a discussion about the issue and an example of how to get round it.

Re: What to replace "conn:send" with?

PostPosted: Mon Feb 08, 2016 12:10 pm
by Trickuncle
Thanks! I'll go over it tonight and try to get that working.

Re: What to replace "conn:send" with?

PostPosted: Mon Feb 08, 2016 12:51 pm
by xtal
if using nodemcu after 0.9.6 use the Call Back's
Send 1
CB send 2
CB send x
CB close