Overhaul of networkconnection.py

- added license
- extracted constants
- many changes in connect() and execute()
- documentation updated