Ported connect() related code to linux