Create a great and really fast Web Server with Basic4PPC!


Active Member
Licensed User
Hi, since few months I didn't know how create a web server on our PPC, I beleive that we've to use a lot of Library with a lot of Mb lol...
In fact it's easy to create our own web server with Basic4PPC...
You just need Network.dll and Binary.dll...

For beginig, you need to create a Server on PORT "80":

Then you must to declare the Client class:

Now you can start you server but it's not finish ;)

You need to create a Timer like the Network.dll example and set interval to 500ms or other and enable it...

In the "wait" Tick sub you wait for request from a web navigator:
If Server.Pending Then 'Client coming in!

In this condition you accept his request from the navigator:

Now with the Binary.dll you open the datas sended by the navigator, this datas contains the URL, Method (GET/POST), Variable set in POST Method and some usefull datas...:

Once that you've open the data you've to read this data as string... The datas sended by the navigator is in Byte[] format, you need to convert it in String format:
Dim buffer(4096) As byte

Now the "datas" variable contains the informations needed... This is an receive data example:

GET / HTTP/1.1
Accept: image/jpeg, application/x-ms-application, image/
if, application/xaml+xml, image/pjpeg, application/x-ms-xbap, application/x-shockwave-flash, applicatio
/, application/, application/msword, */*
Accept-Language: fr-FR
User-Agent: Moz
lla/4.0 (compatible; MSIE 8.0; Windows NT 6.1; Trident/4.0; SLCC2; .NET CLR 2.0.50727; .NET CLR 3.5.30729
 .NET CLR 3.0.30729; Media Center PC 6.0; Tablet PC 2.0; In
oPath.2; .NET4.0C; .NET4.0E)
Accept-Encoding: gzip, deflate
Connection: Keep-Alive
In first line we can see the Method and the url asked by the navigator...
For split this values you just need to use the SubString() function and StrSplit():
Sub Globals
'Declare the global variables here.
Dim buffer(4096) As byte
Dim arg(3) AsString
End Sub
Sub getinfo(txt)
StrSplit(SubString(txt,0,StrIndexOf(txt,CRLF,0))," ")
End Sub
With this function you get the Method name, URL asked and the protocol (Don't care with it)

Sorry I've to go... Will be finish in few hours...
Edit: Sorry I've not enough time in this moment... So be patient for see the end ;)
Last edited: