# Long Term Photon Connection Stability

**URL:** <https://community.particle.io/t/long-term-photon-connection-stability/13925>\
**Category:** Troubleshooting\
**Created:** [July 29, 2015, 5:40pm UTC](https://community.particle.io/t/long-term-photon-connection-stability/13925 "2015-07-29T17:40:07Z")\
**Posts on this page:** 1\
**Showing post:** 128

<div class="post-metadata">

**Author:** ![mhazley](https://sea2.discourse-cdn.com/flex026/user_avatar/community.particle.io/mhazley/32/22184_2.png) [@mhazley](https://community.particle.io/u/mhazley)\
**Post date:** [February 29, 2016, 1:54pm UTC](https://community.particle.io/t/long-term-photon-connection-stability/13925/128 "2016-02-29T13:54:53Z")

</div>

I’ve been using this

```
SYSTEM_MODE (MANUAL);
SYSTEM_THREAD (ENABLED);

```

and

```
if (!Particle.connected()) {
  if (!cloudConnecting) {
      Serial.println("Connecting to cloud!");
      Status::SetDeviceStatus(DEVICE_CLOUD_CONNECTING);
      Serial.println("Particle.connect()");
      Particle.connect();
      cloudConnecting = true;
  } 
} 
else {
  if (cloudConnecting) {
    Serial.println("Connected to cloud!");
  }
  cloudConnecting = false;
}

```

This manages my connection with complete success.

I have also seen the problem you have outlined with green flashing LED. I found it was my use of a UDP socket that was causing it - I had to add a timer to rebuild my socket 5 seconds after a reconnection to the network.

This problem has been outlined [here](https://community.particle.io/t/v0-4-8-rc1-v0-4-9-wifi-reconnection-issue/18904) if you want to have a read.

---

_[View the full topic](https://community.particle.io/t/long-term-photon-connection-stability/13925)._
