fix length of port
move struct url to url.h
add setup_task function
thread version works now