In memory of Ben “bushing” Byer, who passed away on Monday, February 8th, 2016.

Difference between revisions of "WiibServer"

From WiiBrew
Jump to navigation Jump to search
m (Robot: Cosmetic changes)
m (Linkfix)
 
(3 intermediate revisions by 3 users not shown)
Line 10: Line 10:
 
| hbb        = yes
 
| hbb        = yes
 
}}
 
}}
 
 
'''WiiBServer''' is a small and unfinished HTTP/1.0 server, used to test networking functions on the Wii. It loads resources from the front sd card.
 
'''WiiBServer''' is a small and unfinished HTTP/1.0 server, used to test networking functions on the Wii. It loads resources from the front sd card.
  
 
== History ==
 
== History ==
  
I just wanted to play a little with networking functions on the wii so I started with something simple, the [http://jmarshall.com/easy/http/ HTTP/1.0 protocole]. Then I decided to try the sd card api and ended up with threads. Very interesting :-)
+
I just wanted to play a little with networking functions on the wii so I started with something simple, the [http://jmarshall.com/easy/http/ HTTP/1.0 protocol]. Then I decided to try the sd card api and ended up with threads. Very interesting :-)
  
 
However, I won't work much on this project because:
 
However, I won't work much on this project because:
* there's already [[Homebrew_apps/Wii_Web_Server|another project of that kind]]
+
* there's already [[Wii_Web_Server|another project of that kind]]
* the HTTP/1.1 protocole is far more complex to handle
+
* the HTTP/1.1 protocol is far more complex to handle
* there's no real point in running a web server on the wii :-S
+
* there's no real point in running a web server on the wii :-S
* there's already some specialized software for that (apache, ...), would be more interesting to port existing robust software
+
* there's already some specialized software for that (apache, ...), would be more interesting to port existing robust software
* I don't have enough time
+
* I don't have enough time
  
 
== Requirements ==
 
== Requirements ==
Line 38: Line 37:
 
== Source code ==
 
== Source code ==
  
Commented source code is provided. Hope it will help :-) It has been compiled with latest devkitPro (release 20080602).
+
Commented source code is provided. Hope it will help :-) It has been compiled with [[devkitPro]] (release 20080602).
  
 
== Features ==
 
== Features ==
  
 
This server is rather limited (on purpose).
 
This server is rather limited (on purpose).
* process request one after the other (one thread)
+
* process request one after the other (one thread)
* URIs are limited to 1024 cars
+
* URIs are limited to 1024 chars
* resources are loaded from the front sd card, in the /wiibsrv/htdocs folder
+
* resources are loaded from the front sd card, in the /wiibsrv/htdocs folder
  
 
== Missing/TODOs ==
 
== Missing/TODOs ==
  
* memory leaks fixing (if any)
+
* memory leaks fixing (if any)
* multithread (possibly with pooling), the process_request() function should be ready for that
+
* multithread (possibly with pooling), the process_request() function should be ready for that
* error templates stored on sd card, in the /wiibsrv/templates folder
+
* error templates stored on sd card, in the /wiibsrv/templates folder
* directory listing  
+
* directory listing  
* http headers handling
+
* http headers handling
* http/1.1
+
* http/1.1
  
 
== Run ==
 
== Run ==
  
Launched successfully with the [[Twilight Hack]] and the [[Homebrew apps/Wii Homebrew Launcher|Wii Homebrew Launcher]]. Didn't try the [[Homebrew Channel|HBC]] or TcpLoader but should work.
+
Launched successfully with the [[Twilight Hack]] and the [[Wii Homebrew Launcher]]. Didn't try the [[Homebrew Channel|HBC]] or TcpLoader but should work.
  
 
Once started, you should press the 'A' button to start the ''accepting'' thread. Then press 'B' to stop listening. Browse from a web client (use an URL that refers to a file since directory listing is not yet supported).
 
Once started, you should press the 'A' button to start the ''accepting'' thread. Then press 'B' to stop listening. Browse from a web client (use an URL that refers to a file since directory listing is not yet supported).

Latest revision as of 04:51, 29 July 2021

WiiBServer
General
Author(s)Jay
TypeUtility
Version0.1
LicenceNot specified (open source)
Links
Download
Source
Downloadable via the Homebrew Browser
Peripherals
Wiimote1.svg Local WiFi Internet Loads files from the Front SD slot

WiiBServer is a small and unfinished HTTP/1.0 server, used to test networking functions on the Wii. It loads resources from the front sd card.

History

I just wanted to play a little with networking functions on the wii so I started with something simple, the HTTP/1.0 protocol. Then I decided to try the sd card api and ended up with threads. Very interesting :-)

However, I won't work much on this project because:

  • there's already another project of that kind
  • the HTTP/1.1 protocol is far more complex to handle
  • there's no real point in running a web server on the wii :-S
  • there's already some specialized software for that (apache, ...), would be more interesting to port existing robust software
  • I don't have enough time

Requirements

Nothing special on the wii. On the PC side, a web browser. Some files on sd card in the /wiibsrv/htdocs folder.

How does it work

Well, nothing magic here, just socket programming. When started, the server initializes the socket subsystem, setups some parameters (bind), and then listens for incoming connections. The Wii's IP is displayed on screen so that clients can connect.

There's two threads, one that waits for buttons, the other that accepts incoming connections and processes them.

It seems the server freezes after two or three requests, especially after loading multiple resources for a single html page. It also drop when requesting a big image. Not time to fix it, sorry :-O

Source code

Commented source code is provided. Hope it will help :-) It has been compiled with devkitPro (release 20080602).

Features

This server is rather limited (on purpose).

  • process request one after the other (one thread)
  • URIs are limited to 1024 chars
  • resources are loaded from the front sd card, in the /wiibsrv/htdocs folder

Missing/TODOs

  • memory leaks fixing (if any)
  • multithread (possibly with pooling), the process_request() function should be ready for that
  • error templates stored on sd card, in the /wiibsrv/templates folder
  • directory listing
  • http headers handling
  • http/1.1

Run

Launched successfully with the Twilight Hack and the Wii Homebrew Launcher. Didn't try the HBC or TcpLoader but should work.

Once started, you should press the 'A' button to start the accepting thread. Then press 'B' to stop listening. Browse from a web client (use an URL that refers to a file since directory listing is not yet supported).