===========================================================================
Nucleus Samples - Networking
===========================================================================


Purpose & Goals
---------------

This sample application illustrates the use of Networking Middleware APIs
to implement a simple server on the target.  The simple server performs the
following:

    * Setup socket listening on port 8080
    * Wait for new connection
    * Wait for a http get command
    * Print some information to a user such as user's IP information
    * Perform a reverse DNS and tell the user their DNS name
    * Close the connection and go back to listening for a new connection.


What You Will Need
------------------

To run this sample application you will need a Nucleus supported platform
with a BSP that has a Networking device enabled and a networked Host PC
with a Web Browser.

 
Components Used
---------------

Please reference the sample *.config file for a minimal configuration.  Depending on the product
these can be found within the \samples\ folder or at the base of the system project named 
<app_project_name>.<build_config>.config

Building the Application
------------------------

Open the provided development shell, e.g. Nucleus Dev Shell (CS GNU ARM).bat, and execute the following command for the desired platform. 

make PLATFORM=<platform> 

For example, <platform> can be "at91sam9263ek". For more information, please refer to Nucleus ReadyStart reference manual.

As a result of above command, one of the generated output images should be "simple_server.out".


How To Run The Application
--------------------------

Load and run the simple_server.out file. This will print the IP address of the Nucleus target on the STDIO (serial) port.

In your web browsers address input field, type the IPv4 literal address of
the Nucleus target, for instance, 192.168.0.31 - along with the port, and
hit enter. 

http://192.168.0.31:8080/

Your Web Browser should display:

My IP Address is:  nnn.nnn.nnn.nnn, Your IP Address is:  nnn.nnn.nnn.nnn

If you are using DHCP to obtain the target's IP address, the target should
be able to lookup and display the hostname of Web Browser's system:

Your Hostname is: nostname.domainname


You can also specify the address as:

http://192.168.0.31:8080/ip_addr

to show how a specific resource could be specified.  Requesting any other
resource generates the error:

RESOURCE NOT FOUND

NOTE:
Different browsers have different implementation to fetch a url, some after requesting the simple GET command i.e. with resource '/'
follow up by requesting their own implementation dependant resources. As mentioned above, request for any other resource will generate
the "RESOURCE NOT FOUND" logs on the STDIO(serial) port. Don't be alarmed by such logs as this is perfectly normal.