As mentioned above the port is in use already. This could be due to several reasons
close_wait
state when your program is waiting for the other end to close the program.refer (https://unix.stackexchange.com/questions/10106/orphaned-connections-in-close-wait-state).time_wait
state. you can wait or use socket option SO_REUSEADDR
as mentioned in another post.Do netstat -a | grep <portno>
to check the port state.