title: socket program to add integers in c
body: <p>Can any one please tell me how can we send integers from client to server and add them 
    in c.</p>
  
  <p>I was able to send strings successfully  but i am not able to figure out how to send 
    integers.</p>
  
  <p>Please help me out!! The below written code was for reading strings. How can i change it
    it to read and add integers.</p>
  
  <pre><code>#define SOCK_PATH "echo_socket"
  
  int main(void)
  {
  
   int s, t, len;
   struct sockaddr_un remote;
   char str[100];
   if ((s = socket(AF_UNIX, SOCK_STREAM, 0)) == -1) {
   perror("socket");
   exit(1);
  }
  
   printf("Trying to connect...\n");
   remote.sun_family = AF_UNIX;
   strcpy(remote.sun_path, SOCK_PATH);
   len = strlen(remote.sun_path) + sizeof(remote.sun_family);
  
  
   int val=connect(s, (struct sockaddr *)&amp;remote, len);
  
   if ( val&lt; 0) {
   perror("connect");
   exit(1);
   }
  
   printf("Connected.\n");
  
   printf("ENTER THE NUMBERS:");
  
  while(printf("&gt; "), fgets(str, 100, stdin), !feof(stdin)) {
  
  if (send(s, str, strlen(str), 0) == -1) {
  perror("send");
  exit(1);
  }
  if ((t=recv(s, str, 100, 0)) &gt; 0) {
  str[t] = '\0';
   printf("echo&gt; %s", str);
  } else 
  {
    if (t &lt; 0) perror("recv");
    else printf("Server closed connection\n");
    exit(1);
   }
  </code></pre>
  
  <p>}</p>