forums.ps2dev.org Forum Index forums.ps2dev.org
Homebrew PS2, PSP & PS3 Development Discussions
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Pls help..

 
Post new topic   Reply to topic    forums.ps2dev.org Forum Index -> PSP Lua Player Development
View previous topic :: View next topic  
Author Message
Swissidle



Joined: 29 Jan 2009
Posts: 16

PostPosted: Tue Mar 10, 2009 3:03 pm    Post subject: Pls help.. Reply with quote

I need help

http://www.psp-programming.com/animate/wlan.rar

i tested this sample to download using libcurl and it works fine. My question is: is it possible to use this function/eboot inside my lua application? if not.. can someone help me how to convert this c sourcecode into lua script?

Code:
graphicsPrintln("connecting to www.luaplayer.org...")
socket, error = Socket.connect("www.luaplayer.org", 80)
while not socket:isConnected() do System.sleep(100) end
graphicsPrintln("connected to " .. tostring(socket))

-- send request
graphicsPrintln("loading test page...")
bytesSent = socket:send("GET /wlan-test.txt HTTP/1.0\r\n")
bytesSent = socket:send("host: www.luaplayer.org\r\n\r\n")

-- read and display result
requestCount = 0
header = ""
headerFinished = false
while true do
   -- read from test page
   buffer = socket:recv()
   if string.len(buffer) > 0 then
      if headerFinished then
         graphicsPrint(buffer)
      else
         header = header .. buffer
         startIndex, endIndex = string.find(header, "\r\n\r\n")
         if endIndex then
            graphicsPrint(string.sub(header, endIndex))
         end
      end
   end
   
   -- check for incoming requests
   incomingSocket = serverSocket:accept()
   if incomingSocket then
      -- send test page back and close socket
      requestCount = requestCount + 1
      incomingSocket:send("HTTP/1.0 200 OK\r\nContent-Type: text/plain\r\n\r\n")
      incomingSocket:send("Testpage from your PSP.\r\n")
      incomingSocket:send("This was request number " .. requestCount .. ". Reload to increment it.")
      incomingSocket:close()
   end
   if Controls.read():start() then break end
   screen.waitVblankStart()
end


using this sample code from luaplayer, is there a way that i can save the file from http to my memory stick?

thanks.
_________________
<><><><><>>>NOOB<><><><><<>
Back to top
View user's profile Send private message Yahoo Messenger
Display posts from previous:   
Post new topic   Reply to topic    forums.ps2dev.org Forum Index -> PSP Lua Player Development All times are GMT + 10 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group