Fix problem caused by not flushing HTTP headers.
Added code to allow command line specification of host/port details