title: Address family not supported by protocol in connect()
body: <p>Following code is a socket programming sample for TCP client.</p>
  
  <p>But when I run this, connect() is retuned as Address family not supported by protocol.
  i am trying for a server client communication via sockets.
  First we send some strings to the client,Then we read some strings from the client and print them out.</p>
  
  <pre><code>#include&lt;stdio.h&gt;
  #include&lt;sys/types.h&gt;
  #include&lt;sys/socket.h&gt;
  #include&lt;sys/un.h&gt;
  #define ADDRESS     "mysocket"
  char *str[3]={"dfgff","trer","ytt"};
  int main()
  {
  char c;
  FILE *fp;
  register int i,s,ns,len;
  int fromlen;
  struct sockaddr saun,fsaun;
  if((s=socket(AF_UNIX,SOCK_STREAM,0))&lt;0)
  {
  perror("server:socket");
  exit(1);
  }
  
  
    unlink("mysocket");
  
      if (bind(s,&amp;saun,sizeof(saun))&lt;0)
      {
          perror("server: bind");
          exit(1);
      }
  if (listen(s, 5) &lt; 0)
      {
          perror("server: listen");
          exit(1);
      }
  
      if ((ns = accept(s, &amp;fsaun, NULL)) &lt; 0)
      {
          perror("server: accept");
          exit(1);
      }
   fdopen(ns, "r");
  
      /*
       * First we send some strings to the client.
  
      for (i = 0; i &lt;3 ; i++)
          send(ns, str[i], strlen(str[i]), 0);
  
      /*
       * Then we read some strings from the client and
       * print them out.
       */
      for (i = 0; i &lt;3; i++)
      {
          while ((c = fgetc(fp)) != EOF)
          {
              putchar(c);
  
              if (c == '\n')
                  break;
          }
      }
  close(s);
  exit(0);
  return 0;
  }
  </code></pre>