title: recvfrom is not receiving any data, but client is sending the message successfully
body: <p>I have client-server program where I created the socket with sctp protocol and client and server has a onetomany relation.</p>
  <p>when I run the client code the return value of sendto function is greater than zero. But I don't see any message in the server code output.</p>
  <p>Even when the server code is not running and only the client code is running, the client code shows successful message sent. How can it be when the server sockeet is not even open?</p>
  <pre><code>/*
   * Compile:
   *
   *   gcc sctp.c -o server -lsctp
   *
   * Invoke:
   *
   *   ./client
   *   ./server
   */
  
  #include &lt;stdio.h&gt;
  #include &lt;stdlib.h&gt;
  #include &lt;string.h&gt;
  #include &lt;unistd.h&gt;
  #include &lt;libgen.h&gt;
  #include &lt;sys/socket.h&gt;
  #include &lt;sys/types.h&gt;
  #include &lt;netinet/in.h&gt;
  #include &lt;netinet/sctp.h&gt;
  #include &lt;arpa/inet.h&gt;
  
  #define MY_PORT_NUM 21233
  
  static void die(const char *s) {
          perror(s);
          exit(1);
  }
  
  static void server(void) {
          int listen_fd, conn_fd, flags, ret, in;
          struct sctp_sndrcvinfo sndrcvinfo;
          struct sockaddr_in servaddr = {
                  .sin_family = AF_INET,
                  .sin_addr.s_addr = htonl(INADDR_ANY),
                  .sin_port = htons(MY_PORT_NUM),
          };
          struct sockaddr_in client_addr;
          socklen_t clilen=sizeof(client_addr);
          struct sctp_initmsg initmsg = {
                  .sinit_num_ostreams = 5,
                  .sinit_max_instreams = 5,
                  .sinit_max_attempts = 4,
          };
  
          listen_fd = socket(AF_INET, SOCK_SEQPACKET, IPPROTO_SCTP);
          if (listen_fd &lt; 0)
                  die(&quot;socket&quot;);
  
          ret = bind(listen_fd, (struct sockaddr *) &amp;servaddr, sizeof(servaddr));
          if (ret &lt; 0)
                  die(&quot;bind&quot;);
  
  
          ret = listen(listen_fd, initmsg.sinit_max_instreams);
          if (ret &lt; 0)
                  die(&quot;listen&quot;);
  
          for (;;) {
                  char buffer[1024];
  
                  printf(&quot;Waiting for connection\n&quot;);
  
                  in = recvfrom(listen_fd, buffer, sizeof(buffer),0,(struct sockaddr*)&amp;client_addr,&amp;clilen);
                  printf(&quot;%d\n&quot;,in);
                      if (in &gt; 0) {
                              printf(&quot;Received data: %s\n&quot;, buffer);
                              fflush(stdout);
                      }
                  sleep(2);
  
                  
          }
          close(listen_fd);
  }
  
  static void client(void) {
          int conn_fd, ret;
          const char *msg = &quot;Hello, Server!&quot;;
          struct sockaddr_in servaddr = {
                  .sin_family = AF_INET,
                  .sin_port = htons(MY_PORT_NUM),
                  .sin_addr.s_addr = inet_addr(&quot;127.0.0.1&quot;),
          };
  
          conn_fd = socket(AF_INET, SOCK_SEQPACKET, IPPROTO_SCTP);
          if (conn_fd &lt; 0)
                  die(&quot;socket()&quot;);
              
          int i;
          for(i=0;i&lt;4;i++){
              printf(&quot;before sending\n&quot;);
              ret = sendto(conn_fd, (void *) msg, strlen(msg) + 1,0,(struct sockaddr*)&amp;servaddr,sizeof(struct sockaddr));
              printf(&quot;after sending\n&quot;);
              if (ret &lt; 0)
                      printf(&quot;failed to send %d\n&quot;,i);
              else 
                  printf(&quot;success %d\n&quot;,i);
              
              sleep(2);
              
          }
          close(conn_fd);
          
  }
  
  int main(int argc, char **argv) {
  
          if (strstr(basename(argv[0]), &quot;server&quot;))
                  server();
          else
                  client();
  
          return 0;
  } 
  </code></pre>
  <p>this code works when I run the client and server in same machine with loopback IP 127.0.0.1 but when I run them on two different remote machines I am facing this issue.</p>