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 

Minimalist Internet samples

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



Joined: 09 Nov 2005
Posts: 647

PostPosted: Mon May 03, 2010 5:09 pm    Post subject: Minimalist Internet samples Reply with quote

Hi Guys,
I asked this in a forum thread discussing PSP LUA, but I shouldn't really limit my inquiry to LUA.

Are there any minimal examples around for doing simple internet stuff?
There's a few things I'd like to try.

These aren't it, but some examples of simple things could include:

1) Retrieving the time from an SNTP time server such as pool.ntp.org
2) Getting your public IP address from an IP server such as checkip.dyndns.com
3) Logging onto a server with username and password and then clicking a button on a web page

???
Well the third example IS actually what I'd like to have an executable program do.

Cheers, Art.

Thankyou
_________________
If not actually, then potentially.
Back to top
View user's profile Send private message
arnie



Joined: 11 Apr 2009
Posts: 16

PostPosted: Mon May 03, 2010 5:45 pm    Post subject: Reply with quote

You can try looking into InsertWittyName's Phoenix Game Engine. It has some net related material in there.

Checkout the latest svn. ;)

-arnie
Back to top
View user's profile Send private message
Torch



Joined: 28 May 2008
Posts: 842

PostPosted: Mon May 03, 2010 6:21 pm    Post subject: Reply with quote

You mean in LUA or natively on the PSP?

Natively is trivial. Google UNIX socket tutorial. It should work without any modification on the PSP. For the web page, I wonder if the sceHTTP* functions allow you to manually set the headers or POST variables. If they do it makes the job easier.

Other wise just use a socket connection and follow this:
http://developers.sun.com/mobility/midp/ttips/HTTPPost/

For logging in, it depends on whether its a form login, or a HTTP authentication username/password prompt. For the former case you will need to send the username/password via POST variables and the latter you will need to use the Authorization: Basic xxxxxxxxx header in the request. The username/password are Base64 encoded or something. For submitting the form/clicking button its again a POST or GET, both of which you can set the variables in the headers or query string.

You can also use libCurl for this. You can easily set the variables etc in the request.
Back to top
View user's profile Send private message
Art



Joined: 09 Nov 2005
Posts: 647

PostPosted: Mon May 03, 2010 7:49 pm    Post subject: Reply with quote

No it wouldn't have to be done in LUA,
in fact LUA would only make things more difficult for me.

Just about all of the above does sound very scary to me though,
knowing next to nothing about internet stuff, which I guess is why
I said "minimal".
I guess I'd find it easiest if there was a C program sample that
did one or two of these things and nothing more.

For the server I had in mind, a seperate little window pops up asking for username / password combination.
Quote:
A username and password are being requested by http://art.redirectme.net:8181. The site says: "Login Required"

_________________
If not actually, then potentially.
Back to top
View user's profile Send private message
Jim



Joined: 02 Jul 2005
Posts: 487
Location: Sydney

PostPosted: Mon May 03, 2010 8:28 pm    Post subject: Reply with quote

Basic Auth:
Set the header 'Authorization' equal to 'Basic' + space + base64encode(username + ':' + password)

Jim
_________________
http://www.dbfinteractive.com
Back to top
View user's profile Send private message Visit poster's website
Torch



Joined: 28 May 2008
Posts: 842

PostPosted: Mon May 03, 2010 10:04 pm    Post subject: Reply with quote

This is a good resource for minimal HTTP communication: http://www.tutorialspoint.com/http/index.htm

Just open a socket connection just like in any UNIX TCP socket example. Print the HTTP commands, and read the result.

(Don't get confused by the part where it says HTTP is connectionless and the client must disconnect and wait for the server. Just open a connection, write the HTTP request, and read from the same connection.)
Back to top
View user's profile Send private message
Art



Joined: 09 Nov 2005
Posts: 647

PostPosted: Tue May 04, 2010 4:31 am    Post subject: Reply with quote

Ok, I'll take a look, thanks.
_________________
If not actually, then potentially.
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    forums.ps2dev.org Forum Index -> PSP 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