5 Replies Latest reply on Feb 17, 2019 11:24 PM by SiSa_3185206

    Overcoming socket close (7014) error

    agmi_3321141

      Hi,

       

      When sending HTTP packets, the server connection works fine for a while and then I start seeing socket closed error (7014). It doesn't recover from this error. I am using the http_client connect and disconnect api (with TLS). Any inputs on how to gracefully recover from this condition? I can deinit the http client which deletes the socket

        • 1. Re: Overcoming socket close (7014) error
          PriyaM_16

          Hello,

          The correct sequence would be to initialize the connection again after it has failed once. You are already following this sequence using http_client_connect and disconnect APIs. You can keep a check if the network is still up before initializing the connection again using wiced_network_is_ip_up API. In case it is not up, you can insert a delay of few milliseconds and try again. The demo.iot_getway application has similar such implementation. Please have a look at the iot_geteway application.

          Besides can you make sure the server is up and responding, by sending ping messages through another client(ex. curl )?

          1 of 1 people found this helpful
          • 2. Re: Overcoming socket close (7014) error
            agmi_3321141

            Thanks for the suggestions. The wiced_network_is_ip_up API would check if the interface is connected but I don't think that is exactly my issue. It looks like the server closes the socket for some reason and if I re-initialize the socket(deinit and then init http client), I can send requests successfully. In this scenario, I think this the only way is to look for a socket close error code and re-initialize the client?

            • 3. Re: Overcoming socket close (7014) error
              mojec_4003256

              you should close the socket sone time what does happen when the code compiles then after complication the compile process socket still opens. the problem occurs encounter socket in Python. i have also faced this issue when i work for client website name with Write my paper online in this project i face this issue and i was irritated because the error is just out of control.

              the solutions of the problem here is the dirty socket closing which occurs when the script crashes without the proper TCP connection shutdown sequence. Thankfully there's a simple solution which tells the kernel to ignore the fact the socket is already in use (the port it's bound to):

              sock.setsockopt(socket.SOL_SOCKET, socket.SO_REUSEADDR, 1)

              use this the problem should be solved

              • 4. Re: Overcoming socket close (7014) error
                PriyaM_16

                Kindly follow the approach of reinitializing the client if the socket close error is encountered.

                • 5. Re: Overcoming socket close (7014) error
                  SiSa_3185206

                  There are many factors which may effect socket closure while the connection is alive.

                  In order to understand where you are making any mistake, you have to answer to some of the following questions.

                   

                  Which application code are you using??

                  Are you using the snip/https_server and client code or something of your own??

                   

                  Please check if you are passing appropriate socket parameters while initializing.

                  What is the API are you using to initialize a socket?