title: Message not sending : C socket
body: <p>After execution i type the file name in client but its not getting printed in server side. Have tried everything. PLease help. I am using bash in windows. I am just sending a file name from client to server. the server side will display the client.</p>
  
  <p>This is my client.c</p>
  
  <pre><code>#include&lt;stdio.h&gt;
  #include&lt;sys/socket.h&gt;
  #include&lt;sys/types.h&gt;
  #include&lt;string.h&gt;
  #include&lt;netinet/in.h&gt;
  #include&lt;stdlib.h&gt;
  #include&lt;unistd.h&gt;
    int main()
    {
      int i,size,connect_status,sd;
      char sentmsg[100],recvmsg[100];
      int sentlen,sent_status,recvlen,recvbytes;
      struct sockaddr_in client,address;
      sd = socket(AF_INET,SOCK_STREAM,0);
      if(sd == -1)
      {
              perror("Socket Error : ");
              return 0;
      }
  
      client.sin_family = AF_INET;
      client.sin_port = htons(1543);
      client.sin_addr.s_addr = INADDR_ANY;
      for(i=0; i&lt;8;i++)
      {
              client.sin_zero[i] = '\0';
      }
      connect_status = connect(sd,(struct sockaddr*)&amp;client,sizeof(struct sockaddr));
      if(connect_status == -1)
      {
              perror("Connect Error : ");
              return 0;
      }
      printf("\nEnter the file name to be read : ");
      scanf("%s",sentmsg);
      sent_status = send(sd,sentmsg,100,0);
      if(sent_status == -1)
      {
              perror("Sending Error : ");
              return 0;
      }
  
      return 0;
    }
  </code></pre>
  
  <p>This is my server.c</p>
  
  <pre><code>#include&lt;stdio.h&gt;
  #include&lt;sys/socket.h&gt;
  #include&lt;sys/types.h&gt;
  #include&lt;string.h&gt;
  #include&lt;netinet/in.h&gt;
  #include&lt;stdlib.h&gt;
  #include&lt;unistd.h&gt;
  #include&lt;fcntl.h&gt;
  #include&lt;sys/stat.h&gt;
  int main()
  {
      int i,newsd,sd,size,listen_status,bind_status,fd;
      char sentmsg[100],recvmsg[100];
      int sent_status,rec_status,sentlen,recvlen;
      struct sockaddr_in server,address;
      sd = socket(AF_INET,SOCK_STREAM,0);
      if(sd == -1)
      {
              perror("Socket Error : ");
              return 0;
      }
      server.sin_family = AF_INET;
      server.sin_port = htons(1534);
      server.sin_addr.s_addr = INADDR_ANY;
      for(i=0 ; i&lt;8 ; i++)
      {
              server.sin_zero[i] = '\0';
      }
      bind_status = bind(sd,(struct sockaddr*)&amp;server,sizeof(struct sockaddr));
      if(bind_status == -1)
      {
              perror("\nBind Error : ");
              return 0;
      }
      listen_status = listen(sd,5);
      if(listen_status == -1)
      {
              perror("\nListen Error : ");
              return 0;
      }
      size = sizeof(struct sockaddr_in);
      newsd = accept(sd,(struct sockaddr*)&amp;address,&amp;size);
      if(newsd == -1)
              {
              perror("\nAccept Error : ");
              return 0;
      }
      rec_status = recv(newsd,recvmsg,recvlen,0);
      if(rec_status == -1)
      {
              perror("\nRecieve Error : ");
              return 0;
      }
      recvmsg[rec_status] = '\0';
      printf("\nClient : %s",recvmsg);
      return 0;
  }
  </code></pre>
  
  <p>I am unabble to send a message from the client to the server. Please help</p>