diff --git a/examples/cpp/lib/effect.h b/examples/cpp/lib/effect.h
index 0337c7caee39ab2d84c79aea10a7a07844d76b28..a7db83e680c11ea37ab08d4c18b9b18f9571eaae 100644
--- a/examples/cpp/lib/effect.h
+++ b/examples/cpp/lib/effect.h
@@ -182,7 +182,8 @@ inline EffectRunner::EffectRunner()
     lastTime.tv_sec = 0;
     lastTime.tv_usec = 0;
 
-    // Default server
+    // Defaults
+    setMaxFrameRate(300);
     setServer("localhost");
 }
 
@@ -279,22 +280,26 @@ inline void EffectRunner::doFrame(float timeDelta)
     frameInfo.advance(timeDelta);
     effect->beginFrame(frameInfo);
 
-    uint8_t *dest = OPCClient::Header::view(frameBuffer).data();
+    // Only calculate the effect if we have a connection
+    if (opc.tryConnect()) {
+        
+        uint8_t *dest = OPCClient::Header::view(frameBuffer).data();
 
-    for (PixelInfoIter i = frameInfo.pixels.begin(), e = frameInfo.pixels.end(); i != e; ++i) {
-        Vec3 rgb(0, 0, 0);
-        const PixelInfo &p = *i;
+        for (PixelInfoIter i = frameInfo.pixels.begin(), e = frameInfo.pixels.end(); i != e; ++i) {
+            Vec3 rgb(0, 0, 0);
+            const PixelInfo &p = *i;
 
-        if (p.isMapped()) {
-            effect->calculatePixel(rgb, p);
-        }
+            if (p.isMapped()) {
+                effect->calculatePixel(rgb, p);
+            }
 
-        for (unsigned i = 0; i < 3; i++) {
-            *(dest++) = std::min<int>(255, std::max<int>(0, rgb[i] * 255 + 0.5));
+            for (unsigned i = 0; i < 3; i++) {
+                *(dest++) = std::min<int>(255, std::max<int>(0, rgb[i] * 255 + 0.5));
+            }
         }
-    }
 
-    opc.write(frameBuffer);
+        opc.write(frameBuffer);
+    }
 
     effect->endFrame(frameInfo);
 
diff --git a/examples/cpp/lib/opcclient.h b/examples/cpp/lib/opcclient.h
index 0ccff623bce44457daae90dcc82844e0c42abecc..413fa31a66a5789f8e14982d3895b91df9f902d1 100644
--- a/examples/cpp/lib/opcclient.h
+++ b/examples/cpp/lib/opcclient.h
@@ -47,6 +47,8 @@ public:
     bool resolve(const char *hostport, int defaultPort = 7890);
     bool write(const uint8_t *data, ssize_t length);
     bool write(const std::vector<uint8_t> &data);
+
+    bool tryConnect();
     bool isConnected();
 
     struct Header {
@@ -139,12 +141,15 @@ inline bool OPCClient::isConnected()
     return fd > 0;
 }
 
+inline bool OPCClient::tryConnect()
+{
+    return isConnected() || connectSocket();
+}
+
 inline bool OPCClient::write(const uint8_t *data, ssize_t length)
 {
-    if (!isConnected()) {
-        if (!connectSocket()) {
-            return false;
-        }
+    if (!tryConnect()) {
+        return false;
     }
 
     while (length > 0) {
@@ -170,7 +175,7 @@ inline bool OPCClient::connectSocket()
     fd = socket(PF_INET, SOCK_STREAM, IPPROTO_TCP);
 
     if (connect(fd, (struct sockaddr*) &address, sizeof address) < 0) {
-        close(fd);
+        closeSocket();
         return false;
     }
 
diff --git a/examples/cpp/spokes.cpp b/examples/cpp/spokes.cpp
index ab8d5db6b2248bd0b113130be37298ae644e9edc..1d03fa922404d8be6c451c7285fffc9659d0f05e 100644
--- a/examples/cpp/spokes.cpp
+++ b/examples/cpp/spokes.cpp
@@ -76,7 +76,6 @@ int main(int argc, char **argv)
 
     EffectRunner r;
     r.setEffect(&br);
-    r.setMaxFrameRate(200);
     r.setLayout("../layouts/grid32x16z.json");
     return r.main(argc, argv);
 }