This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts

Connection Problems to a TCP Server

Hi, 

I have a nRF9160DK with a Sim Card from a local provider, that supports NB-IoT.

I modified the example program  in \ncs\zephyr\samples\net\sockets\echo and wanted to set up a connection from the nRF9160 to my TCP Server. That didn't work and then I tried to connect it to the Google DNS server as a test. That didn't work either and I am out of ideas now on what could be the problem. This is the error message I get from the LTE Monitor:

The LTE Monitor log file:

My code (c file):

My prj.conf file:

Do you have any idea what could cause the error? Is the structure of the c file correct, or do you set up the connection with other commands?

Thanks for your help and your answers!

Parents
  • I don't have full knowledge about this, but don't you need to bind the file descriptor with the address using bind() ( between socket() and connect())? Try this and see if it works then.

    If you still have problems, I will take a closer look at your issue/ask somebody with more knowledge about it.

    Best regards,

    Simon

  • Hi, i tried it with this code now:

    But I still get an error like this:

    I really would appreciate it, if you could take a closer look/ask somebody with more knowledge, because I am out of ideas on what could be the cause of the issue.

    Thanks for your time and your help!

  • Hi Simon,

    I'm working on something similar, and I'd like to execute the AT commands when the program starts, rather that typing them into the LTE Link Monitor. Is there a code sample for how to do that?

    Thanks!

    Calin

  • Bergmann said:
    Thanks for your big help!

    No problem, I am always happy to help and I am glad it finally worked out.

     

    Bergmann said:
    So the next step would be to change the connect_to_goolge project so that it connects to my TCP server?

    Yes, I believe it should be all good now, and that would be the next step yes. If that doesn't work, you know that the issue is not with the code but your TCP server. Take a look at this link, which talks about port forwarding and how to make the server accessible on the web.

    Best regards,

    Simon

  • Calin M:

    I wrote a quick sample earlier that demonstrated how to write AT commands from your code:

    at_commands_test.zip

    Is this what you are looking for? If not, or if you have more questions, could you open a new ticket? Since this question is unrelated to the initial question.

    Best regards,

    Simon

  • Hi Simon,

    That's what I was looking for, thanks!

    Calin

  • I was now able to send data to my TCP server!

    Thanks for your help!

Reply Children