IoShield A+ Arduino DUE as Server TCP


I have and Wiznet IoShieldA that I connect to an Arduino DUE in order to become a TCP SERVER.

I downloaded Arduino IDE 1.6.12.
I copy in the Ethernet library the Wiznet Ethernet library.
in utility/w5100.h I uncommented #define WIZ550io_WITH_MACADDRESS

Then I wen to the the TCP Example

I copy this code in a new sketch, and I gives me an error.
Problem is in

 if (client == true)

Reading some forums, it seems the example is wrong and should modify it to

if (client)

I changed the MAC (the one written in the Wiznet), IP and Subnet to be the one that fits my Server.

I donwloaded the code in my Arduino DUE+ioShield- A without trouble.

To test if it worked I connected ioshield by means of a crossed utp cable to the PC, I put the PC in the same net as Arduino, with the same mask.
I try to test the doe using AX1 application. I go to TCP> Connect … it takes some seconds, and finally Connection Failed message appears.

I don’t know why. Any help will be appreciated.

I tested the Arduino as Client using AX1 with the same configuration and it worked.
Here is my code:

[code]#include <Ethernet.h>

// network configuration. gateway and subnet are optional.

// the media access control (ethernet hardware) address for the shield:
byte mac = { 0x00, 0x08, 0xDC, 0x4D, 0xD1, 0x22 };
//the IP address for the shield:
byte ip = { 10, 1, 3, 1 };
// the router’s gateway address:
//byte gateway = { 10, 0, 0, 1 };
// the subnet:
byte subnet = { 255, 255, 255, 0 };

// telnet defaults to port 23
EthernetServer server = EthernetServer(3000);
void setup()
// initialize the ethernet device
Ethernet.begin(mac, ip);

// start listening for clients

void loop()
// if an incoming client connects, there will be bytes available to read:
EthernetClient client = server.available();
if (client) {
// read bytes from the incoming client and write them back
// to any clients connected to the server:

[quote=“svia”]I put the PC in the same net as Arduino, with the same mask.

byte mac[] = { 0x00, 0x08, 0xDC, 0x4D, 0xD1, 0x22 }; byte ip[] = { 10, 1, 3, 1 }; //byte gateway[] = { 10, 0, 0, 1 }; byte subnet[] = { 255, 255, 255, 0 }; [/quote]

You should set gateway IP address properly too. Note that gateway is out of scope for network 10.2.3.x.