MKR1000 - problem with wifi101 client.connect(..)

Hi guys,

I have a problem with connecting to websites using Wifi Client. Sometimes it will connect OK but mostly the “client.connect(…)” call fails. Any idea what I am doing wrong?

I have strong wifi signal and have tried it on a number of diiferent WiFi networks connected to different ISP’s. Connecting to WifI network is no problem but it seems connecting to the public internet is failing most of the time.

I am using latest libraries and firmware (passes firmware check):

WiFi101 firmware check.

WiFi101 shield: DETECTED
Firmware version installed: 19.5.4
Latest firmware version available : 19.5.4

Any help would be appreciated!


Here is my code:

#include <WiFi101.h>
#include <WiFiClient.h>
#include <SPI.h>

char ssid = “WifiSSID”; // network SSID (name)
char pass = “WiFiPWD”; // network password

bool val = true;

int wifistatus = WL_IDLE_STATUS;

WiFiClient client(80);

void setup() {
Serial.begin(9600); // initialize serial communication
delay(1000); // Wait for Serial port to stabilize for write
Serial.println(“Started Serial Port…”);

// Check for the presence of Wifi Module
Serial.print("Wifi Module: ");
if (WiFi.status() == WL_NO_SHIELD) {
Serial.println(“NOT FOUND”);
return; // don’t continue

// attempt to connect to Wifi network:
while ( wifistatus != WL_CONNECTED) {
Serial.print("Attempting to connect to Network named: ");
Serial.println(ssid); // print the network name (SSID);
wifistatus = WiFi.begin(ssid, pass);
if (wifistatus != WL_CONNECTED) {
delay(10000); // wait 6 seconds before retrying for connection
printWifiStatus(); // connected to Wifi now, so print out the status of wifi connection

// Connect to to get public IP address
Serial.println(“Attempting to connect to to get Public IP Address”);
if (!client.connect(“”, 80)) {
Serial.println(“Failed to connect with ‘’”);
else {
Serial.println(“Successfully Connected to ‘’”);

// read response from
int timeout = millis() + 8000;
bool respRcvd = true;
String line;

client.print(“GET / HTTP/1.1\r\nHost:\r\n\r\n”);
while (client.available() == 0) {
if (timeout - millis() < 0) {
Serial.println(">>> Client Timeout !");
respRcvd = false;
if (respRcvd) {
line = client.readStringUntil(’\n’);
Serial.print("External/Public IP Address is: ");
void loop() {

// some stuff will go here later (once external IP address is reliably determined in setup()


void printWifiStatus() {
// print the SSID of the network you’re attached to:
Serial.print(“Successfully Connected to Network with SSID: “);
Serial.print(” (wiFi Status: “);

// print Board’s Local IP address:
IPAddress ip = WiFi.localIP();
Serial.print(" Local IP Address: ");

// print Board’s Gateway IP address:
IPAddress gwip = WiFi.gatewayIP();
Serial.print(" Gateway IP Address: ");

// print the received signal strength:
long rssi = WiFi.RSSI();
Serial.print(" signal strength (RSSI): “);
Serial.println(” dBm");

int encryptionType = WiFi.encryptionType();
Serial.print(" encryption type: “);
Serial.println(” (TKIP (WPA)=2,WEP=5,CCMP (WPA)=4,NONE=7,AUTO=8)");

Check result: PASSED

My Wifi101 library version is: 0.15.3

Arduino IDE version is 1.8.8

Here is my code (

Ok - solved!

My Ziggo ISP modem/router had a firewall setting set to "low" which is described as "no restrictions" on their UI!

When I set it to "off" - everything works consistently (as opposed to oiccasionally!).