return -1 on socker.error