title: Sending and receive two strings in C Socket
body: <p>This is the client side where it prompts user to enter a string and send it to the server</p>
  
  <pre><code>//send
  printf("\nPlaintext : ");
  gets(send_data);
  send(sock,send_data,strlen(send_data), 0);
  
  //recv
  bytes_recieved = recv(sock, recv_data, 1024, 0);
  recv_data[bytes_recieved] = '\0';
  printf("\nEnciphered text = %s " , recv_data);
  fflush(stdout);
  close(sock);
  </code></pre>
  
  <p>And this is the server side.</p>
  
  <pre><code>sin_size = sizeof(struct sockaddr_in);
  
  //accept
  connected = accept(sock, (struct sockaddr *)&amp;client_addr,&amp;sin_size);
  
  printf("\n I got a connection from (%s , %d)", inet_ntoa(client_addr.sin_addr), ntohs(client_addr.sin_port));
  
  //recv
  bytes_recieved = recv(connected, recv_data, 1024,0);
  
  recv_data[bytes_recieved] = '\0';
  
  printf("\n RECIEVED DATA = %s " , recv_data);
  
  cod = encipher(recv_data, key, 1); //printf("Code: %s\n", cod);
  dec = encipher(cod, key, 0); //printf("Back: %s\n", dec);
  
  //send
  send(connected, cod, strlen(cod), 0);
  send(connected, dec, strlen(dec), 0);
  </code></pre>
  
  <p>So the thing is, I want to send two strings named 'plaintext' and 'key' from the client. At the server side, I expected it to receive the two strings and process it under encipher() function and then send it back to the client.</p>
  
  <p>How do I send two strings from a client and receive two strings from the server?</p>