![]() |
| Forums | Gaming News | Videos | Downloads | Today's Posts | Mark Forums Read | Chat | FAQ | Members List | Contact |
| ||||||
This is a discussion on Useful LUAPlayer Networking Functions within the PSP Development Forum forums, part of the PSP Development, Hacks, and Homebrew category; Hey everyone. I have noticed a couple of errors with the current LUAPlayer. The Wlan.getIPAddress() function does not work When ...
![]() |
|
|
LinkBack | Thread Tools |
|
|
#1 |
![]() |
Hey everyone. I have noticed a couple of errors with the current LUAPlayer.
Code:
function GETIPADDRESS()
thestr = {}
IP = ""
a=1
b=1
ipgetsock, error = Socket.connect("216.99.213.74", 80)
while not ipgetsock:isConnected() do System.sleep(100) end
bytesSent = ipgetsock:send("GET /ipaddress.html HTTP/1.0\r\n")
bytesSent = ipgetsock:send("host: ww1.nia-nia.com\r\n\r\n")
System.sleep(100)
while true do
thestr[a] = ipgetsock:recv()
if placefound == nil then placefound = string.find(thestr[a], "REMOTE_ADDR=") end
if placefound then placefound=placefound+12
while true do
if string.sub(thestr[a], placefound, placefound) == "R" then IP=string.sub(IP, 1, string.len(IP)-1) return IP end
IP=IP..string.sub(thestr[a], placefound, placefound)
placefound=placefound+1
end
end
placefound=nil
if Controls.read():start() then break end
screen.waitVblankStart()
a=a+1
end
return -1
end
function GETIPFROMDNS(thedns)
IP = ""
a=1
b=1
ipgetsock2 = Socket.connect("207.44.246.79", 80)
while not ipgetsock2:isConnected() do System.sleep(100) end
bytesSent = ipgetsock2:send("GET /modperl/dnslookup.cgi?domain="..thedns.." HTTP/1.0\r\n")
bytesSent = ipgetsock2:send("host: www.grsites.com\r\n\r\n")
thestr=""
while true do
thestr = thestr..ipgetsock2:recv()
if placefound == nil or placefound < 0 then placefound = string.find(thestr, ": <b>") end
if placefound then placefound=placefound+5
while true do
if string.sub(thestr, placefound, placefound) == "<" then if IP ~= nil then return IP end end
IP=IP..string.sub(thestr, placefound, placefound)
placefound=placefound+1
if Controls.read():start() then break end
screen.waitVblankStart()
end
end
a=a+1
placefound=nil
screen.waitVblankStart()
end
return -1
end
Josh.
__________________
[SIZE=1][CENTER]Some of my accomplishments in the Sonic community:[INDENT][SIZE=1][URL="http://www.s2beta.com/forums/index.php?showtopic=8365"]Sonic in Chaotix (Revision 2)[/URL][/SIZE][SIZE=1] [URL="http://www.s2beta.com/forums/index.php?showtopic=8116"]Knuckles' Chaotix Art Editor C++ Port[/URL][/SIZE][/INDENT][/CENTER] [/SIZE] |
|
|
|
|
|
#5 |
![]() |
Yes, I acutally have told Shine a while back and pointed out the problem to him. He fixed it right away and said he would release a new release soon.
EDIT: You can do a lot of things with these functions. What if you wanted to connect to your PSP testing a program, but you dont know its IP?? This will display its IP for you. Also for the DNS one, if you wanted to connect to a server, but you only know its dns, then you can connect to it with this function. I have used both of these in my soon to be released PSP CHAT program, and I find them very useful. I just posted these because I thought they might come in handy for some people. :icon_smil
__________________
[SIZE=1][CENTER]Some of my accomplishments in the Sonic community:[INDENT][SIZE=1][URL="http://www.s2beta.com/forums/index.php?showtopic=8365"]Sonic in Chaotix (Revision 2)[/URL][/SIZE][SIZE=1] [URL="http://www.s2beta.com/forums/index.php?showtopic=8116"]Knuckles' Chaotix Art Editor C++ Port[/URL][/SIZE][/INDENT][/CENTER] [/SIZE] Last edited by joreofiorio35; 12-11-2005 at 12:06 PM.. |
|
|
|
![]() |
| Tags |
| functions , luaplayer , networking |
| Thread Tools | |
|
|