| HTTPServer( | const | char | * | hostname, | | | | struct | ip_addr | | ip | = | ip_addr_any, | | struct | ip_addr | | nm | = | ip_addr_any, | | struct | ip_addr | | gw | = | ip_addr_any, | | struct | ip_addr | | dns | = | ip_addr_any, | | unsigned | short | | port | = | 80 | ) |
|
Creates an HTTPServer object. You might want to initialise the network server befor. If you dont do it it will be happen by the first post or get request you make.
To initialize the network server on creation of the HTTPServer object it’s possible to parse some arguments
Variables: hostname - A host name for the device. Might take a while to appear in the network, depends on the network infrastructure. Furthermore in most cases you have to add your domainname after the host name to address the device. Default is NULL. ip - The device ipaddress or ip_addr_any for dhcp. Default is ip_addr_any nm - The device netmask or ip_addr_any for dhcp. Default is ip_addr_any. gw - The device gateway or ip_addr_any for dhcp. Default is ip_addr_any. dns - The device first dns server ip or ip_addr_any for dhcp. Default is ip_addr_any.
Example
HTTPServer http; // Simple DHCP, brings up the TCP/IP stack on bind(). Default prot is port 80.
HTTPServer http(8080); // Port is here 8080.
HTTPServer http("worf"); // Brings up the device with DHCP and sets the host name "worf"
// The device will be available under worf.<your local domain>
// for example worf.1-2-3-4.dynamic.sky.com
HTTPServer http("wolf", // Brings up the device with static IP address and domain name.
IPv4(192,168,0,44), // IPv4 is a helper function which allows to rtype ipaddresses direct
IPv4(255,255,255,0), // as numbers in C++.
IPv4(192,168,0,1), // the device address is set to 192.168.0.44, netmask 255.255.255.0
IPv4(192,168,0,1) // default gateway is 192.168.0.1 and dns to 192.168.0.1 as well.
8080); // And port is on 8080. Default port is 80.