Greetings,
A little question about net module usage: How can I make a request from eLua? (or more generally: How can I send things to known hosts from eLua?) I've, naively, tried net.send(net.connect(0,net.packip("192.168.0.100"),8080),"headerless string =)") (I'm using a LM3S8962 , and there is a server running on 192.168.0.100:8080) I really don't get the net.connect first param, it's supposed to be a socket. But how can I possibly get a valid socket value? Sorry to bother with basic doubts... --Pedro Bittencourt _______________________________________________ Elua-dev mailing list [hidden email] https://lists.berlios.de/mailman/listinfo/elua-dev |
Updating:
Figure out how to use net.socket and net.connect. Now a simple request is working on external sites (like www.google.com) doing something like: sock = net.socket(0) host = net.packip("x.x.x.x") --this changes, so... port = 80 --for default err_con = net.connect(sock,host,port) s, err_send = net.send(sock, <a giant request header string>) r, err_res = net.recv(sock,"*l") net.close(sock) print(r) But I still can't geta response from my server. I get err_res=2 , where can I find the error-codes definitions? --Pedro Bittencourt On Thu, Jun 11, 2009 at 7:36 PM, Pedro Bittencourt <[hidden email]> wrote: Greetings, _______________________________________________ Elua-dev mailing list [hidden email] https://lists.berlios.de/mailman/listinfo/elua-dev |
Updating (2, the revenge):
Now everything seems to work fine. Don't know exactly what caused the response error, I've tried to make the server take a little long to send it back to the LM module and it worked. Maybe the response came before the net.recv function could enter the "listen" state causing some trouble with the reception. Now...one other thing, how can I get my localhost address with net module? --Pedro Bittencourt On Sat, Jun 13, 2009 at 3:57 AM, Pedro Bittencourt <[hidden email]> wrote: Updating: _______________________________________________ Elua-dev mailing list [hidden email] https://lists.berlios.de/mailman/listinfo/elua-dev |
I recall when poking around before that it doesn't seem like there's a way to do this with the module? It should be simple to add though. I think such a thing would be quite useful for situations, where, say you could display the address on a built-in LCD so that you know what address is set for a given micro? It certainly could simplify things with LuaRPC and figuring out which address to connect to from a desktop. Speaking of which, having something like zeroconf supported for autodiscovery would be quite nice to have as well. I've not looked into the spec to see how it works, but it doesn't seem to use XML at least :-) Looks like someone started some work here: -jsnyder On Jun 14, 2009, at 7:43 PM, Pedro Bittencourt wrote: Updating (2, the revenge): -- James Snyder Biomedical Engineering Northwestern University ph: (847) 448-0386 _______________________________________________ Elua-dev mailing list [hidden email] https://lists.berlios.de/mailman/listinfo/elua-dev |
In reply to this post by Bittencourt
You're right James, there isn't a way to do this with this module (which is highly experimentan anyway) right now. Anyway, if you have a static IP, you should know it already :); if you get it via DHCP, however, you're out of luck right now. I'll add a function to get the external IP of the eLua host, thanks for pointing this out.
Best, Bogdan On Mon, Jun 15, 2009 at 5:45 PM, James Snyder <[hidden email]> wrote:
_______________________________________________ Elua-dev mailing list [hidden email] https://lists.berlios.de/mailman/listinfo/elua-dev |
Free forum by Nabble | Edit this page |