input check

input check. invalid input caused tcp socket api crash