I finally checked out Shine's WLan script, and edited it to retrieve a file off my own webserver.
Anyway...in short I was curious if it's possible to connect the PSP to a computer, by having the PSP run a lua script (say as a client) and trying to connect to the computer who is running a server specifically for the PSP.
I tried but failed :S I used an old server I made in C++/WinSock and tried editing the WLan file, but couldn't get it to work.
It's probably something I did wrong or am not seeing, but anyone have any ideas why it wouldn't work? Limited functionality on Luaplayer or something like that perhaps..? Anyways thanks a lot for the help :)
Sockets with PSP/Lua
Moderators: Shine, Insert_witty_name
Hey,
Not sure if this helps, but I've got Lua talking to my web server via HTTP Post calls. Here is some code that does the POSTing:
Just replace /RPC with the path and filename to your PHP, ASP, or other web script, and you can now send multiple variables from the psp to the webserver.
I'm still working on getting the response and parsing it to display useful data on the screen. But for my purposes right now I only need to issue commands from the PSP to the webserver. For those curious, I'm using the PSP as a controller for something. This time it's not my home... You'll have to wait until Jan 5th to find out what it is.
Not sure if this helps, but I've got Lua talking to my web server via HTTP Post calls. Here is some code that does the POSTing:
Code: Select all
function sendToWebserver(text)
length = string.len(text)
socket, error = Socket.connect("192.168.1.50", 80)
while not socket:isConnected() do System.sleep(100) end
bytesSent = socket:send("POST /RPC HTTP/1.1\r\n")
bytesSent = socket:send("Content-Type: application/x-www-form-urlencoded\r\n")
bytesSent = socket:send("Content-Length: "..length.."\r\n")
bytesSent = socket:send("\r\n")
bytesSent = socket:send(text.."\r\n\r\n")
closeIt = socket:close()
end
sendToWebserver("method=TriggerEventByName&Param1=systemStartup&Param2=0&Param3=0&Param4=0")
I'm still working on getting the response and parsing it to display useful data on the screen. But for my purposes right now I only need to issue commands from the PSP to the webserver. For those curious, I'm using the PSP as a controller for something. This time it's not my home... You'll have to wait until Jan 5th to find out what it is.
-
- Posts: 11
- Joined: Thu Dec 29, 2005 12:32 am
It should not need to be a webserver, although the above code is specific to an HTTP connection.
A good way to test and make sure your communicating is to use a telnet server program. I use this one called Hercules all the time:
http://www.hw-group.com/products/hercules/index_en.html
Just start up the TCP server, set the port and then try to connect to it from your PSP.
Also, make sure you are using the correct WLAN connection. That caused some confusion for me. The LAST WLAN connection you create is numbered 0 when you activate the wlan adapter.
A good way to test and make sure your communicating is to use a telnet server program. I use this one called Hercules all the time:
http://www.hw-group.com/products/hercules/index_en.html
Just start up the TCP server, set the port and then try to connect to it from your PSP.
Also, make sure you are using the correct WLAN connection. That caused some confusion for me. The LAST WLAN connection you create is numbered 0 when you activate the wlan adapter.
doh I made an app in delphi in 5 minutes to wich the psp sent the du,p from irda.... 5minutes :) and it worked. now I'm stuck trying to make an updater for my chat. how to know where the http ends and data begins ... maybe I'll add a --beginlua line at the start of the script and then search it xD yup good ide
//away xD
//away xD