Thread: Connection Refused when trying to Connect TCP UDP connection Simultaneoulsy

  1. #1
    Registered User
    Join Date
    Dec 2014
    Location
    Mumbai, Maharashtra, India, India
    Posts
    14

    Connection Refused when trying to Connect TCP UDP connection Simultaneoulsy

    Hello ,

    I am writing a application to Generate mixed traffic of TCP UDP Protocol. I have written socket program which generate TCP and UDP Stream with input Parameters supplied like Packet Size, Time and number of thread. Connection Refused when trying to Connect TCP UDP connection Simultaneoulsy-sender-jpegConnection Refused when trying to Connect TCP UDP connection Simultaneoulsy-receiver-jpeg

    When I run to generate alone TCP or UDP , its working fine But When i try to generate a mixed traffic it show error on Sender side by saying Connection Refused. after that Program gets Terminated.

    All order of Connection are Same on Both side . Each Connection is at Different port .

    Code of Sender for Mixed Traffic is as Follow . Similar Code is at Receiver Side .

    Code:
         case 'm':
                  {    
                  
                     if (NUM_THREADS<2)
                     {
                         printf("\n At least Two Thread are required to run\n");   
                         exit(-1);
                     }
                     
                  
             if (NUM_THREADS%2==0)
             {
              UDP_Thread=NUM_THREADS/2;
           TCP_Thread=NUM_THREADS/2;
             }         
             
             else 
             {
              UDP_Thread=NUM_THREADS/2;
           TCP_Thread=NUM_THREADS/2+1;
             }    
             
             
             printf("\n Number of TCP Thread going to Create %d",TCP_Thread);  
         for (t=0;t<TCP_Thread;t++)
             {
              printf("\n Started Thread %d\n",t);
              rc=pthread_create(&tid[t], NULL,Send_tcp,(void*)&port[t]);
              if (rc) 
             {
             printf("ERROR; return code from pthread_create() is %d\n", rc);
             exit(-1);
             }
                printf("\n Started Sending for Port No %d",port[t]);
             }     
             
            
        printf("\n Number of UDP Thread going to Create %d",UDP_Thread);   
        for (t=0;t<UDP_Thread;t++)
             {
              printf("\n Started Thread %d\n",TCP_Thread+t);
              rc=pthread_create(&tid[t], NULL,Send_udp,(void*)&port[TCP_Thread+t]);
              if (rc) 
             {
             printf("ERROR; return code from pthread_create() is %d\n", rc);
             exit(-1);
             }
                printf("\n Started Sending for Port No %d",port[TCP_Thread+t]);
             }

  2. #2
    Hurry Slowly vart's Avatar
    Join Date
    Oct 2006
    Location
    Rishon LeZion, Israel
    Posts
    6,788
    And why do you try to connect when sending over UDP?
    What is your Send_udp function doing?
    All problems in computer science can be solved by another level of indirection,
    except for the problem of too many layers of indirection.
    – David J. Wheeler

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. System call and Connection refused
    By Tzadkiel in forum C Programming
    Replies: 2
    Last Post: 02-20-2011, 08:51 PM
  2. no connection
    By saurav_sarkar in forum Tech Board
    Replies: 7
    Last Post: 03-19-2005, 05:42 AM
  3. SSH connection
    By Thantos in forum Tech Board
    Replies: 3
    Last Post: 11-02-2003, 06:33 PM
  4. Connection...
    By JaWiB in forum Tech Board
    Replies: 8
    Last Post: 02-25-2003, 10:46 PM
  5. SSL Connection from CGI
    By tetradtech in forum Linux Programming
    Replies: 0
    Last Post: 10-25-2002, 01:13 PM

Tags for this Thread