-
• #2
Hi,
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.
As the port of Espruino to a particular board continues, a lot of questions have come up on implementing the board specific portion of the networking functions. To attempt to understand this area better, a first pass at a document has been written that attempts to describe the board specific functions. This document will be elaborated on over time and eventually submitted to the Espruino project when the porting project has completed.
1 Attachment