title: How to send double-type data via TCP/IP Winsock
body: <p>I'm trying to send sensor data (double type) from client to server via TCP/IP (Winsock). In theory, after connected successfully, we will execute the command send().</p>
  
  <p>I use 2 variables: stringstream ss and string res to store sensor data and convert double type into char type. But when I sent data, on the server showed: Date Time Current Voltage Air-Pressure 000000000000000000000000000000000000000… All data are 0.</p>
  
  <p>I tried other methods but server only received empty or incorrect values. Please suggest me how to fix this problem. Here's my code:</p>
  
  <pre><code>char Data_Send[10000];
  char item[] = " Date\t" "Time\t" "Current\t" "Voltage\t" "Air-Pressure\t";
  string res;
  stringstream ss;
  
  strcpy(Data_Send, item);    
  for (int32 i = 0; i &lt; returnedCount; i = i + channelCount)
  {
      ss &lt;&lt; userDataBuffer[i];  // Sensor data
      ss &gt;&gt; res;
      strcat(Data_Send, (char*)&amp;res);
  }
  
  if (connect(socketClient, (sockaddr*)&amp;clientAddr, sizeof(clientAddr)) == 0)
                      {
                          cout &lt;&lt; "\nConnection success..!";
                          cout &lt;&lt; "\nConnect with Server's IP: " &lt;&lt; inet_ntoa(clientAddr.sin_addr);
                          cout &lt;&lt; "\nStart communicating";
  
                          cin.getline(Data_Send, 5120);
                          send(socketClient, (char*)&amp;Data_Send, sizeof(Data_Send), 0);                
                      }
  </code></pre>