Rinnegatamante / lpp-3ds

Lua Player Plus for 3DS
GNU General Public License v3.0
179 stars 32 forks source link

Sockets not working. #30

Closed PabloMK7 closed 8 years ago

PabloMK7 commented 8 years ago

Tried to request a http file with sockets. function testsocket() Socket.init() checksckt = Socket.connect("ctgp.dshack.org", 80, false) -- (Also tried with the ip 133.130.123.204, still doesn't work) Socket.send(checksckt, "GET /check.txt HTTP/1.0\r\n\r\n") checkscktdata = Socket.receive(checksckt, 1024) Socket.term() end Printing checkscktdata returns: " " (nothing)

Rinnegatamante commented 8 years ago

You don't even wait between sent data and receive function. It's normal that your code results in an empty string.

PabloMK7 commented 8 years ago

How much should I wait then.

Rinnegatamante commented 8 years ago

It depends on server quality, connection quality, etc...

Normally, a loop should be used, for example: https://github.com/Rinnegatamante/CHMM2/blob/master/source/index.lua#L1170-L1228

PabloMK7 commented 8 years ago

Yes, I figured it out, thanks :D. I tried now to connect to an https server, but using ssl returns couldn't stablish ssl connection, and setting it to false crashes.

PabloMK7 commented 8 years ago

nvm

I'll post a Function in lpp3ds thread, so people can use it, thanks!