I am passing cmd arguments one by one from send function from clients like this :
for( i = 3; i < argc; i++)
{
//memset(buffer, '\0', sizeof(buffer));
//bzero(buffer, sizeof(buffer));
//strcpy(buffer, argv[i]);
n = send(sockfd, argv[i], strlen(argv[i]), 0);
//n = send(sockfd, buffer, strlen(buffer), 0);
if(n <= 0 )
{
perror("Error in writing2 : ", sockfd);
return FAILURE;
}
}
here's the server side code for recv :
for( j = 0; j < arg_no; j++)
{
//memset(buffer, '\0', sizeof(buffer));
bzero(buffer, sizeof(buffer));
n = recv(clientfd, buffer, sizeof(buffer), 0);
if(n <= 0)
{
showerror("Error in reading2 : ", clientfd);
break;
}
}
The problem I am facing here is that whole of the **argv is getting passed once and its waiting for recv after that, causing the program to halt. I even tried passing arguments by copying it to a buffer and then sending(commented code), but it din't work.