====== Networking ======
30.10.2014
===== SocketTest from Akshathkumar Shetty =====
http://sockettest.sourceforge.net/
It's a simple Java Tool for testing any TCP or UDP Client/Server applications or services, which are based on text-data-transfer.
{{::sockettest:screenshot-tcp-client.png?direct&200|}}
{{:sockettest:screenshot-tcp-server.png?direct&200|}}
{{:sockettest:screenshot-udp.png?direct&200|}}
===== Fiddler Web Debugger =====
31.10.2014\\
http://www.telerik.com/fiddler \\
Seems to be a quite useful tool for having a look on the web traffic.
===== HTTP GET vs. POST =====
1.11.2014\\
Let's have a look at this simple HTML code:
Leave a comment:
It looks like this in the browser: \\
{{networking:form-screenshot.png?direct&200|}}
I set up a local TCP-server with [[#SocketTest]] on port 8080. I open the html-file above in my browser, and click submit. What the server receives is:
POST /process.php HTTP/1.1
Host: localhost:8080
User-Agent: Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:29.0) Gecko/20100101 Firefox/29.0
Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8
Accept-Language: en-US,en;q=0.5
Accept-Encoding: gzip, deflate
Connection: keep-alive
Content-Type: application/x-www-form-urlencoded
Content-Length: 53
name=Jon+Doe&rating=2&comment=enter+comments+here+...
As we see, we get all the input-fields (name-value-pairs), which are defined in the form. The data is transmitted in the HTTP-message-body. This is, because we used the **method="post"**.\\
When we use **method="get"**, the server receives folloing message:
GET /process.php?name=Jon+Doe&rating=2&comment=enter+comments+here+... HTTP/1.1
Host: localhost:8080
User-Agent: Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:29.0) Gecko/20100101 Firefox/29.0
Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8
Accept-Language: en-US,en;q=0.5
Accept-Encoding: gzip, deflate
Connection: keep-alive
As we can see now, all the name-value-pairs are transmitted in the HTTP-message-header, and the message has no body.
A HTTP request header ends with an empty line. The new line characters are , as used in the Windows-world.
===== nmap =====
check accessible ports on a computer in the network or on the internet:
nmap -A zeilhofer.co.at
===== Learning HTML =====
http://www.simplehtmlguide.com\\
[[https://www.youtube.com/watch?v=bWPMSSsVdPk|Youtube: Learn HTML in 12 Minutes]]\\
[[https://www.youtube.com/watch?v=KJ13lX20FqU|Youtube: Learn more HTML in 12 Minuts]]
[[http://library.albany.edu/imc/pdf/HTML-XHTML_Tag_Sheet.pdf|HTML, XHTML and HTML5 Cheat Sheet as a PDF]]
===== Learning PHP =====
I have created a printable version of "PHP Programming" on wikibooks.org\\
https://en.wikibooks.org/wiki/Wikibooks:Collections/PHP_Programming
Here are links to my first PHP files:\\
http://www.zeilhofer.co.at/php_learning/helloworld.php \\
";
?>
http://www.zeilhofer.co.at/php_learning/myfirstphpfile.php?relay1=5&relay2=7
";
// print unix time stamp (in seconds)
// append strings with dot
echo "unix time = ".time()."s
";
// receive arguments form the url (webrequest):
// declare variables:
$relay1 = $_REQUEST['relay1'];
$relay2 = $_REQUEST['relay2'];
echo "relay1 = $relay1 and relay2 = $relay2";
?>
===== php.ini =====
diff /etc/php5/apache2/php.ini /usr/share/doc/php5-common/examples/php.ini-development
If this command returns nothing, then your PHP uses dev configuration.
diff /etc/php5/apache2/php.ini /usr/share/php5/php.ini-production
If this command returns nothing your PHP uses production configuration.
If you want to use dev configuration,
sudo cp /usr/share/doc/php5-common/examples/php.ini-development /etc/php5/apache2/php.ini
If you want to use production configuration,
sudo cp /usr/share/php5/php.ini-production /etc/php5/apache2/php.ini
{{tag>software english web programming}}