Socket programming ring topology

I have to implement udp communication between 4 node(terminals) : A,B,C,D in ring topology manner. A->B, B->C, C->D, D->A. Any node can initiate a conversation. 4 ports have been allocated for each AB,BC,CD,DA links. port 1 signifies sending port. port2 signifies receiving port. Both of these ports have been linked to their respective sockets.(sock2 and sock1). The node initiating the conversation is able to send the packet but the other nodes are not able to receive the message. Please run this code in 4 terminals and let me know where is the fault.(HINT: The code is working fine till this statement comes bytes_received=recvfrom(sock1,recv_buf,sizeof(recv_buf),0,(struct sockaddr*)&s_server1,&si_len1); It is unable to receive anything.

# include<sys/socket.h>
# include<sys/time.h>
# include<arpa/inet.h>
# include<string.h>
# include<stdio.h>
# define BUFFERSIZE 1024
# define SERVERADDR "127.0.0.1"

int main ()
{
    int sock1, sock2,pid,b;
    int node, PORT1, PORT2;
    int bind_status , bytes_received , bytes_sent ;
    char send_buf[BUFFERSIZE], recv_buf[BUFFERSIZE] ;
    struct sockaddr_in s_server1,s_client1,s_server2,s_client2 ;
    int si_len1 = sizeof (s_client1) ;
    int si_len2 = sizeof (s_client2) ;
    struct timeval tv1,tv2;
    double time_diff;
    printf("Enter the node terminal:- A-1,B-2,C-3,D-4 \n");
    scanf("%d",&node);
    //printf("%d", node);


    if (node == 1)
    {
       PORT1 = 5000;          //sending port
       PORT2 = 5003;          //receiving port
    }
    if (node == 2)
    {
       PORT1 = 5001;
       PORT2 = 5000;
    }
    if (node == 3)
    {
       PORT1 = 5002;
       PORT2 = 5001;
    }
    if (node == 4)
    {
       PORT1 = 5003;
       PORT2 = 5002;
    }

    // Creating the socket
    sock1 = socket(AF_INET,SOCK_DGRAM,IPPROTO_UDP) ;
    if (sock1 < 0)
    {
       printf("Socket creation failed. \n");
    }
    else
    {
       printf ("Socket created with descriptor %d\n ", sock1 ) ;
    }
    sock2 = socket(AF_INET,SOCK_DGRAM,IPPROTO_UDP) ;
    if (sock2 < 0)
    {
       printf("Socket creation failed. \n");
    }
    else
    {
       printf ("Socket created with descriptor %d\n ", sock2 ) ;
    }

    // Initializing and binding the socket
    s_server1 .sin_family= AF_INET ;
    s_server1 .sin_port=htons(PORT2);
    s_server1 .sin_addr.s_addr=htonl(INADDR_ANY);

    bind_status =bind(sock1,(struct sockaddr*)&s_server1,sizeof (s_server1));

    if(bind_status< 0)
    {
       printf(" Binding socket  failed. \n" ) ;
    }

    else
    {
       printf("Binding socket successful. \n") ;
    }

    if(!inet_aton(SERVERADDR, &s_server1.sin_addr))
    {
       printf("IP network format conversion failed");
       return 1;
    }

    else
    {
       printf("IP network format conversion successful.\n");
    }

    s_server2.sin_family =AF_INET;
    s_server2.sin_port =htons(PORT1);
    printf("port %d assigned for sending \n",PORT1);



    printf(" Are you initiating the conversation? If Yes: 1, no: 0\n");
    scanf("%d", &b);
    printf(" b is %d\n", b);

    if (b==1)
    {
       printf("Message to send: ");
       scanf("%s",send_buf);
       sprintf(send_buf, "%dhello", node); 
       printf("%s\n", send_buf);
       bytes_sent=sendto(sock2,send_buf, sizeof(send_buf),0,
       (struct sockaddr*)&s_server2, si_len2);  
       gettimeofday(&tv1,NULL);
       printf ( "%d bytes of data sent : %s \n " , bytes_sent , send_buf) ;
       strcpy (recv_buf,send_buf) ;
       printf("recv_buff is %s\n",recv_buf);
       bytes_received=recvfrom(sock1,recv_buf,sizeof(recv_buf),0,(struct 
       sockaddr*)&s_server1,&si_len1);
       gettimeofday(&tv2,NULL);
       printf("hello");
       printf( "%d bytes of data received : %s\n", bytes_received,recv_buf ) ;
       time_diff=(tv2.tv_sec*1000000+tv2.tv_usec)- 
       (tv1.tv_sec*1000000+tv1.tv_usec);
       time_diff/=1000;
       printf("Time difference=%lf\n",time_diff);
    }
    else 
    {
       printf("waiting for messages\n");
       bytes_received=recvfrom(sock1,recv_buf,sizeof(recv_buf),0,(struct 
       sockaddr*)&s_server1,&si_len1);
       printf( "1024 bytes of data received : %s\n", recv_buf ) ;
       strcpy (send_buf,recv_buf) ;
       bytes_sent=sendto(sock2,send_buf, sizeof(send_buf),0,(struct 
       sockaddr*)&s_server2, si_len2);      
       printf ( "1024 bytes of data sent : %s \n " ,  send_buf) ;

    }

    return 0 ;
}