I am having a problem where a TCP socket opened with the CC300 will eventually stop working. I am not sure why this is happening, but I am not able to reconnect unless I wait 30 seconds. I have tested the server, and connections from other sources can connect again instantly.
Program flow:
send packet once a second
if 10 attempts fail:
close socket
open socket
connect
I tried even power cycling the CC3000 during this:
send packet once a second
if 10 attempts fail:
close socket
wlan_stop()
wait 1 second
wlan_init
wlan_start
connect to network
open socket
connect
And It still doesn't work. If I put a breakpoint at that last connect, and count with my watch to 30 seconds, then let it run, it will connect just fine.
When I had this problem on my server, I used socket_set_option($sock,SOL_SOCKET,SO_REUSEADDR,1) which fixed it on that end. Why is this option not accessible on the CC3000?
Is there another work around? Or do I have to put in a 30 second wait between connects?