HI everybody, I´m having trouble again with the TCP functions. This time I need to restart a tcp connection and then I need to re-established it again. The first that came into my mind was to use the sutdown function. It worked Ok because I lost connection between my application and my PC. My problem is when I try to re-establish the connection, i need to use: RTCS_create(); but I don´t know why it doesn´t responds RTCS_OK, so the connection is never created. I tried restarting my task but the same happened, RTCS_create() returned a value different from zero. for example 1704 and 1300 which I don´t know what do they mean. Thank you very much, best regards.
Hi,
Based on subject “socket shutdown” and message content you are closing TCP socket connection.
But for some reason, you are trying re-establish connection by RTCS_create(), that is used for initialization of RTCS stack and it should be called once. You should use Socket API instead.
Best regards,
Andrey
Hi Andrey thank you very much for your interest and help, when you say I have to use the Socket API you mean the RTCSLOG_disable() or RTCSLOG_enable()? Does this help to get my connection active again? Sorry for my ignorance in this topic, but I`m new with it and i`m in a rush right now because the deadline of this project is really close. I`m going to read about this to see what I learn. Have a nice day and again thank you very much.
I forgot something that could be important, as you correctly adviced me, I didn´t call the RTCS_create() only once, the only thing that I did was try to connect again with : the connect function: connect(sock, &addr, sizeof(addr)); but the thing is that it doesn´t respond RTCS_OK either.
Hi,
1. Functions RTCSLOG_disable()/_enable() are used to disable/enable RTCS event logging in the MQX kernel log.
They have nothing with socket API.
2. You can not call connect(), if the socket is already connected or the socket is closed.
3. It's good to read a "RTCS User Manual"; find a TCP client source code inside RTCS and use it as reference for your project.
Best regards,
Andrey