What is the problem with this server program?


int main()
int fd_server, fd_client, len;
struct sockaddr_in add_server;
fd_server = socket(AF_INET,SOCK_STREAM,0);
if (fd_server == -1){
add_server.sin_family = AF_INET;
add_server.sin_port = htons(4001);
add_server.sin_addr.s_addr = inet_addr("");
len = sizeof(add_server);
if( bind(fd_server,(struct sockaddr*)&add_server,len) != 0)
if(listen(fd_server,5) != 0)
fd_client = accept(fd_server,(struct sockaddr*)&add_server,&len);
if(fd_client == -1)
return 0;
a) it can not accept the request of any client
b) it will give the segmentation fault
c) there is no problem with this program
d) none of the mentioned

Submitted by: Murtaza
a) it can not accept the request of any client
Submitted by: Murtaza

Read Online Linux Debugging Job Interview Questions And Answers