This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

TIrtos TCP echo to diffrent port



Hi, 
Ive tryed to connect to a pc with a tm4c129 rtos evaluation module. The echo-server example runs good and i've modiefied it to send to another port on an incomming message
Here is the task-code. The issue is that i gain no return or any network-traffic. Its something really easy so may you help me ?


    SOCKET lSocket;
    int optval=0;
    int optlen=sizeof(optval);
     struct sockaddr_in sLocalAddr;
     int status;
    // create socket
    lSocket = socket(AF_INET, SOCK_STREAM, IPPROTO_TCP);
    if (lSocket < 0) {
        System_printf("tcpHandler: socket failed\n");
        Task_exit();
        return;
    }
    setsockopt(lSocket, SOL_SOCKET, SO_KEEPALIVE, &optval, optlen);
    memset((char *)&sLocalAddr, 0, sizeof(sLocalAddr));
    sLocalAddr.sin_family = AF_INET;
    sLocalAddr.sin_len = sizeof(sLocalAddr);
    sLocalAddr.sin_addr.s_addr = inet_addr("192.168.2.3");
    sLocalAddr.sin_port = htons(1100);

    // connect
    status = connect(lSocket, (struct sockaddr *)&sLocalAddr, sizeof(sLocalAddr));
    send(lSocket, "End\n", 4, 0 ); System_printf("E:0\n"); System_flush();


Note:  creating the socket-handle is sucsessfull, connecting fails

  • Johannes Nieland said:
    Here is the task-code. The issue is that i gain no return or any network-traffic. Its something really easy so may you help me ? 

     Its so easy? Why asking help for?

    Johannes Nieland said:
        SOCKET lSocket;
        int optval=0;
        int optlen=sizeof(optval);
         struct sockaddr_in sLocalAddr;
         int status;
        // create socket
        lSocket = socket(AF_INET, SOCK_STREAM, IPPROTO_TCP);
        if (lSocket < 0) {
            System_printf("tcpHandler: socket failed\n");
            Task_exit();
            return;
        }

     Is socket set here???? Or miserably fail?

     its so simple....

  • Is socket set here???? Or miserably fail?
    the socket was set there, but i still cant send or connect
  •  So isn't so simple??

     Try set parameter before set socket so this can avoid expose code to dangling reference too.

     This formum has transformed in a free of charge C programming school.

     Many of us are tired of this and we encourage stop have to browse tons of buggy code for free. If this is a wish TI to support then a proper area can be the best way.

  • I'm sorry to hear that =( I came here to get help because i really stuck there. But anyway i fixed the issue by doing the connect in a while loop. So you dont have to cry anymore.
  • eheheh Johannes, we have two "brilliant minds" in the forum are as God knows everything and take others as morons!

    I do not understand what comes to the forums if they already know everything ...

    Best Regards
    Robalo
  • eheheh Johannes, we have two "brilliant minds" in the forum are as God knows everything and take others as morons!

    Every one posting here clearly sees the website owner (TI) and the name of the forum (Tiva ARM), telling you what questions it deals with. Any one failing to recognise that is truly a moron.

    I do not understand what comes to the forums if they already know everything ...

    A lot / most of the question asked here are answered by volunteering users, not by TI employees. Consider that not everybody is just here to take.

    And to the OP: basic C language and network programming specific questions are not the focus of this forum.

    Check if your problem can be tied to TiRTOS, to the TM4C ethernet stack implementation, or rather general network / BSD socket programming issues.

    Consider a test implementation of your idea/algorithm on another platform (e.g. a PC). If that also fails, some network-specific forum might serve you better.

  • f. m. said:
    Consider a test implementation of your idea/algorithm on another platform (e.g. a PC). If that also fails, some network-specific forum might serve you better

     Hi F.M. yes this is a basic programming error, just I stated as Dangling reference, so why it work when you do a loop? WHY don't work first time?

     ANdD i wish have an answer to still noisy spammer Robalo is still there offending people doing work.

     That Robalo showed us not having basic C programming knowledge NOR MINIMAL HTML knowledge asking a more low lelev question than this.

     This is a programming error but we are STILL definitively tired to have similar FLEAS at our head!

     So F.M. please tell MR Aquino or Robalo what is wrong on code so if it is so clever try help solve this ITS a SIMPLE issue that isn't ?

      Mr. Johannes, your primary isn't so simple how it sound to us?

     Is this TM4C issue?

     IS this a basic scket programming error?

     No and YES so we cannot answer to tons of useless request about wrong code nor we cannot do basic HTML to tailor a screaming kid like this Aquino is not able to deal with and is still persecuting people here.

     Its time to stop this ì.

     Sorry Johannes, we are closing free answering on not on topic. If you have few neurons than Aquino (Robalo) you can read again your question apologizes then think what is between these lines.

     The worst condition posing this is we have to stop kid like Robalo coming here to mess up we are professional.

  • Johannes Nieland said:
    Is socket set here???? Or miserably fail?
    the socket was set there, but i still cant send or connect

     Johannes why this fails what on socket pointer to structure?

     Did you know what is a dangling reference???

     Your word "is so simple" sound worst to us overtired to many people come here asking help for basic error then offending, sorry, you must change your wording or tell someone explain you why your post sound so bad.

     The triggering of this are some people offending and at last this Robalo never get kiked off.

     If you need help reword in a kind manner question, but I think if you follow F.M and retry on another platform you find your code is failing too... Have an idea why?

     Failure is not TIVA related nor IDE tools, is a programming error!

     Looping is not a solution, a dangling reference is a BAD issue, has to be removed from root or you fail at unexpected point.

     This not platform related, forever fails!

  • Robalo said:
    I do not understand what comes to the forums if they already know everything ...

     Silly kid how many people have you helped here screaming to modify two lines of HTML code tossing a tons of offending words?

     How many we are here really helping?

     AMIT, how much time we must have  this flea here?

     How much help and how much this increase support and if I stop using TI forum and Chips too?

     This say it have 100 pieces show us bill.. I never observed stock drop in 100 unit.

     Amit, I fear you can remain the last one here and none professional use TI product on this asylum!

     So if someone need help we have kid Robalo talking about how much it smells after it performance... so Diapers maker sell kids products TI sell products for smelling kid?

     Here are TI next tools:

    http://www.diapers.com/