Serial Monitor get's flooded with "No Socket Available" message. This seems to occur even before I Try to communicate with my Hue bridge through my hub port. Does anyone see why this is occurring after my wireless connection is established?

Serial Output:

Firmware needs upgrade
Attempting to connect to WPA SSID: ifiw_ym
connected to the networkSSID: ifiw_ym
BSSID: 0:B2:8F:6A:C4:28
signal strength (RSSI):-47
Encryption Type:4

IP Address:
MAC address: 78:C4:E:1:9F:B1
in loopin loopin loopNo Socket available
No Socket available
in loopNo Socket available
No Socket available
in loopNo Socket available
No Socket available
in loopNo Socket available
No Socket available 


#include <SPI.h>
#include <WiFi.h>

//  Hue constants
const char hueHubIP[] = "";
const char hueUsername[] = "my_hue_app";
const int hueHubPort = 80;

boolean activated = false;

//  Hue variables
boolean hueOn;
int hueBri;  // brightness value
long hueHue;  // hue value
String hueCmd;  // Hue command

unsigned long buffer=0;  //buffer for received data storage
unsigned long addr;

// Wireless network
char ssid[] = "**********";
char pass[] = "**********";
int status = WL_IDLE_STATUS;
WiFiClient client;


void setup() {
  while (!Serial) {

  if (WiFi.status() == WL_NO_SHIELD) {
    Serial.println("WiFi shield not present");
    while (true);

  String fv = WiFi.firmwareVersion();
  if (fv != "1.1.0") {
    Serial.println("Firmware needs upgrade");

  while (status != WL_CONNECTED) {
    Serial.print("Attempting to connect to WPA SSID: ");
    status = WiFi.begin(ssid, pass);

    // wait 10 seconds for connection:

  Serial.print("connected to the network");

void loop() {
  Serial.print("in loop");
  // printCurrentNet();

void alterHueColors() {
    client.println("Hue is activated");

     // A series of four sample commands, which colour fades two lights between red and pink. Read up on the Hue API
    // documentation for more details on the exact commands to be used, but note that quote marks must be escaped.
    String command = "{\"on\": true,\"hue\": 50100,\"sat\":255,\"bri\":255,\"transitiontime\":"+String(random(15,25))+"}";
    command = "{\"on\": true,\"hue\": 65280,\"sat\":255,\"bri\":255,\"transitiontime\":"+String(random(15,25))+"}"; 
    command = "{\"hue\": 65280,\"sat\":255,\"bri\":255,\"transitiontime\":"+String(random(15,25))+"}";
    command = "{\"hue\": 50100,\"sat\":255,\"bri\":255,\"transitiontime\":"+String(random(15,25))+"}"; 

    activated = true;
      activated = false;

      //was activated, so send a single off command
      String command = "{\"on\": false}";

It's also interesting to not that my print calls in alterHueColors() aren't triggering.

Full .ino file

  • 1
    For one thing, your logic is backwards. activated = false to begin with. So in alterHueColors() the if condition will never be true and only the else block gets executed because it keeps activated = false;. Aug 21, 2017 at 2:57
  • 1
    Second, can you open from any other pc on the network? Aug 21, 2017 at 2:58
  • @johnnyMopp Thanks for finding that, i've noticed that as well. Fixed it locally, I will update. After update it does go through the else. The is accessible on my browser. However, the No Socket Available message still occurs in serial monitor. Aug 21, 2017 at 3:14


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.