if(listen(sockh, SOMAXCONN)!=0)
This function returns 0
when it succeeds. Your conditional check is backwards.
Read the documentation and for the love of Kahless indent your code properly.
2
solved failed to listen and connect winsock2 [closed]