Your program requires that a port number is passed on the command line. So pass that when starting it:
myserver 5001
Alternatively you can hard code the port number by changing the code as suggested by CPallini. But then you have to comment / remove the line getting the port number too:
sockfd = socket(AF_INET, SOCK_STREAM, 0);
if (sockfd < 0)
error("ERROR opening socket");
bzero((char *) &serv_addr, sizeof(serv_addr));