It'd be really helpful if that document was in GitHub or something like a Gist - then it could easily be added to?
createsocket: Question: Can this return an error indication ... for example ... -1?
Yes. It's in the existing documentation i keep pointing you at: if host=0, creates a server otherwise creates a client (and automatically connects). Returns >=0 on success
What does it mean to receive a request to close a socket (a connection) when there is still asynchronous work in flight
Yes - just close after everything has been sent (even if there is now received data)
Idle: What is the design intent for this function? How might it be used?
Again, in the docs /// Called on idle. Do any checks required for this device. Not all devices are interrupt driven - some still need to poll - and this is for that.
checkError: What is the design intent for this function? How might it be used?
And: /// Call just before returning to idle loop. This checks for errors and tries to recover. Returns true if no errors.
It's more of a hack for CC3000 and you can ignore it. In the CC3000 the whole thing may spontaneously crash. checkError allows the CC3000 code to check for this and if there's a problem to attempt to restart it before anything is done in the socket library.
Question: What is the value of an IP address if the hostname can't be found?
It's 0 - but just not writing the return value is enough.
Espruino is a JavaScript interpreter for low-power Microcontrollers. This site is both a support community for Espruino and a place to share what you are working on.
Hi,
It'd be really helpful if that document was in GitHub or something like a Gist - then it could easily be added to?
Yes. It's in the existing documentation i keep pointing you at:
if host=0, creates a server otherwise creates a client (and automatically connects). Returns >=0 on success
Yes - just close after everything has been sent (even if there is now received data)
Again, in the docs
/// Called on idle. Do any checks required for this device
. Not all devices are interrupt driven - some still need to poll - and this is for that.And:
/// Call just before returning to idle loop. This checks for errors and tries to recover. Returns true if no errors.
It's more of a hack for CC3000 and you can ignore it. In the CC3000 the whole thing may spontaneously crash. checkError allows the CC3000 code to check for this and if there's a problem to attempt to restart it before anything is done in the socket library.
It's 0 - but just not writing the return value is enough.