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.

cc3000 socket connect problem



Hi,

    I am using cc3000 as client in my project, once it was  connected  and worked fine for one time,next time onwards i am unable to connect to server as connect function is returning -1.

   

  • Hi Arun,

    Can you please give more details? Please explain how you are running the client? Is the server running when the client tried to connect? Also please share the air traces if it is available.

    Thanks & Regards,

    Raghavendra

  • Hi Raghavendra,

                       First i am running  tcp server which will connect and  accept data from client.Below points are how i am connecting to server.

     1.In My project first i am  connecting my cc3000 module to wifi so that cc3000 gets IP address

    2. Once ip is assigned then i am using cc3000 (as client) to connect to server so that i can send some data to server.

    3. one time cc3000  was connected to server and worked fine. but next time onwards i am unable to connect to server.

    4.  using bsd socket functions i am  able to open the socket  but unable to connect to server as connect function is returning -1. I took care of port number and ip address of server in my code but also i am unable to open a connection to server.

    5. connect function takes some time and returns -1. i  got struck in this function .Please guide me i am going wrong .

  • Hi Arun,

    Are you running your TCP server on a laptop? Can you please check if there are any firewalls enabled? My guess is that the server is rejecting the incoming connections.

    Or the port is not open for some reason. Can you please try with bigger port numbers, say above 1234 on the server?

    Please send me the air capture logs. It will give some initial idea.

    Thanks & Regards,

    Raghavendra

  • Hi Raghavendra,

         Ya i am running my TCP  server on my lap. Now i am able to connect  to server  and send data.but problems i am facing are

    1.  first i need to ping to cc3000 before i can connect to server,if i do this then it works fine.

    2. suppose If i doesn't ping ,then i cannot connect to server.

    3. even though i send data i cannot close the socket which i opened  it strucks in send function , but in server i can see the data received. after send function it is not coming to closesocket function.         

  • Hi Raghavendra,

                           ya i am running with big port number  8080.

  • Hi Arun,

    1) With respect to connect, it looks like your server is rejecting the connections. Can you please try it with a different device running as a TCP server?

    2) And as far as the 'send' goes, Can you please check if the send returns any return values? Can you please add the trace in evnt_handler.c for the case 'HCI_EVNT_SEND' event? And also please add a trace in 'simple_link_send' function in socket.c after sending the command 'HCI_CMND_SEND'.

    Thanks & Regards,

    Raghavendra

  • Hi Raghavendra,

     1) After doing send function i can see data in server but send function returns 0 .

    2) i cant understand what to add in event_handler.c .can u please tell me what is trace means.    

  • Hi Aun,

    Please add the print messages for the above mentioned events in evnt_handler.c.

    Thanks & Regards,

    Raghavendra

  • Hi Raghavendra,

                        I am using cc3000 as client, i am able to receive data from server and able to send data  which i can see in server but my send function is showing return value 0 but it has to show how many bytes i have sent . i am sending 8 bytes .so it stucks in send function hence i cant close the socket.

    Regards,

    Arun j