Added tcp server recognition and fixed ending file byte issues.