Connect() fails using Ethernet Board + Ethernet Library

Using the Arduino sketch below, in an Arduino Ethernet Rev 3 board, I see some blinks of the Arduino TX/RX LEDs that look like connection attempts, but the connection attempts never succeed. I also see blinking at my (desktop) network switch.

The "server" code is a python routine that is able to accept connections from a different python routine (both are in the same Windows computer) that I wrote for testing this sort of thing. I have posted snippets of the python routine.

This has got to be something simple; but I am stumped. I have searched the web for similar problems; and I have searched the first 15 pages of this site's "Networking, Protocols and Devices" history, all to no avail.

Hopefully someone will spot my problem, or remember how they solved a similar one, or will offer a checklist of things for me to double check.

Here is the Arduino "Client" code.

#include <SPI.h>

#include <Dhcp.h>
#include <Dns.h>
#include <Ethernet.h>
#include <EthernetClient.h>
#include <EthernetServer.h>
#include <EthernetUdp.h>
#include <util.h>


void setup() 
   {
   // put your setup code here, to run once:
   // ------------------- Ethernet Setup section ---------------------------//
   byte myMac[] = { 0x90, 0xA2, 0xDA, 0x0D, 0xB7, 0xE6 };
   byte myIP[] = { 192, 168, 0, 10 };
   byte dns[] = { 192, 168, 0, 1 };
   byte gateway[] = { 192, 168, 0, 1 };
   byte mySubnet[] = { 255, 255, 255, 0 };
   byte serversIP[] = { 192, 168, 0, 2 };
   int serversPort = 14531;
   EthernetClient client;

   Serial.begin(9600);
   
   delay(1000);
   Serial.println("5");
   delay(1000);
   Serial.println("4");
   delay(1000);
   Serial.println("3");
   delay(1000);
   Serial.println("2");
   delay(1000);
   Serial.println("1");
   delay(1000);
   Serial.println("0");
   
   Ethernet.begin(myMac, myIP);
//   Ethernet.begin(myMac, myIP, dns, gateway, mySubnet);
   delay(1000);
   Serial.print ("My IP = ");      Serial.println (Ethernet.localIP());
   Serial.print("connecting to port "); Serial.print(serversPort); 
   Serial.print(" at "); Serial.print(serversIP[0]); 
   Serial.print("."); Serial.print(serversIP[1]); 
   Serial.print("."); Serial.print(serversIP[2]); 
   Serial.print("."); Serial.print(serversIP[3]);
   Serial.println("...");
   
//   client.connect(serverIP, serversPort);
   if (client.connect(serversIP, serversPort)) 
      {
      Serial.println("connected");
      } 
   else 
      {
      Serial.println("connection failed");
      }

   }

void loop() 
   {
   // put your main code here, to run repeatedly: 
   }

Here are snippets of the "Server" python code:

...
addressFamily = AF_INET
connectionType = SOCK_STREAM
clientAddress = '192.168.0.2'
serverAddress = '192.168.0.2'
...
serversAcceptPort = 14531
serversAcceptNodeInfo = (serverAddress, serversAcceptPort)
talkToServerSocket = None
...
mySvrSock.bind(self.serversAcceptNodeInfo)
serverAcceptTimeout =10.0                         
mySvrSock.settimeout(serverAcceptTimeout)
mySvrSock.listen(0)
...
talkToClientSocket, talkToClientNodeInfo = mySvrSock.accept()
...

Any thoughts?

GBlakeR

Did you allow tcp port 14531 through your Windows firewall?

Thank you SurferTim. And ...

Oh, oh, oh ,oh, oh, how I loath Windows, and their idiotic categorization of networks into Domain, Private and Public.

I know I got a Windows Firewall pop-up when I was doing some prep work about a day and a half ago. I thought I answered it correctly, but who can tell without a ouija board.

TCP/UDP/IP networks, don't have a Domain/Private/Public flag in their protocols, nor do sockets, nor do... and Windows' dumbed-down help is about as useful as a fish for your bicycle.

And of course no other pop-ups appeared since that first one, to tell me about the blocking.

OK - I'll stop ranting.

Hopefully this exchange will be easily found by the next poor soul who searches this forum for the same reason I did.

Thanks again ST.