added nonblock, reuseaddr and nodelay function