Tag Archives: server

Python – Hello World Client

0
Filed under python
Tagged as , , , , , , ,

Author: slac3dork
Site: http://snippet.c0de.me
Summary: Simple client which initiate connection on port 3000 at localhost. Tested on Linux.
Usage: You need helloworld-server to process helloworld-client request

#!/usr/bin/python
#
#  _________      .__       .____   _______
# /   _____/ ____ |__|_____ |    |  \   _  \    ____
# \_____  \ /    \|  \____ \|    |  /  /_\  \  / ___\
# /        \   |  \  |  |_> >    |__\  \_/   \/ /_/  >
#/_______  /___|  /__|   __/|_______ \_____  /\___  /
#        \/     \/   |__|           \/     \//_____/
# http://snippet.c0de.me
# slac3dork[at]gmail[dot]com  

import socket 

s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
s.connect(("127.0.0.1", 3000))
print s.recv(1024) # up to 1024 bytes



python,logo,banner

Python – Hello World Server

0
Filed under python
Tagged as , , , , , ,

Author: slac3dork
Site: http://snippet.c0de.me
Summary: Simple server which listen on port 3000 at localhost. Tested on Linux.
Usage: You need helloworld-client to initiate connection and get response from hello world server.

#!/usr/bin/python
#
#  _________      .__       .____   _______
# /   _____/ ____ |__|_____ |    |  \   _  \    ____
# \_____  \ /    \|  \____ \|    |  /  /_\  \  / ___\
# /        \   |  \  |  |_> >    |__\  \_/   \/ /_/  >
#/_______  /___|  /__|   __/|_______ \_____  /\___  /
#        \/     \/   |__|           \/     \//_____/
# http://snippet.c0de.me
# slac3dork[at]gmail[dot]com  

import socket 

s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
s.bind(("127.0.0.1", 3000))
s.listen(1) # max connection = 1
q,v = s.accept()
q.send("Hello World from Python Server")



python,logo,banner

PHP – Server and Execution Environment Information

0
Filed under php
Tagged as , , , , , , ,

Author: slac3dork
site: http://snippet.c0de.me
summary: Php code to get server and execution environment information. Based on $_SERVER php manual.

<?php

/**
  _________      .__       .____   _______
 /   _____/ ____ |__|_____ |    |  \   _  \    ____
 \_____  \ /    \|  \____ \|    |  /  /_\  \  / ___\
 /        \   |  \  |  |_> >    |__\  \_/   \/ /_/  >
/_______  /___|  /__|   __/|_______ \_____  /\___  /
        \/     \/   |__|           \/     \//_____/  

http://snippet.c0de.me

slac3dork@gmail.com
*/

/**
* PHP Server and Execution Environment Information
* Coded By slac3dork
* Special Thanks to Myrddin and Jeffwk who are giving me inspiration.
*/
echo '<h2><p align="center">Server And Execution Environment Information</p></h2>';
echo '<table border="3" align="center">';
foreach ($_SERVER as $key => $value) {
	if (!$value) {
		$value = '-';
	}
	echo '<tr>';
	echo '<td>'.$key.'</td>'.'<td>'.$value.'</td>';
	echo '</tr>';
}
echo '</table>';
?>



php,logo,pixel badge,badge