Hi
I have two Global Cache devices here, one is a GC-100-12 (wire) and another is a iTach WF2SL (wireless).
I have a Arduino with a Ethernet Shield so i tried to connect with my Global Cache units.
Everything works when i tried to connect with the GC-100-12 (ip 192.168.0.160), i can send and get data over the tcp connection,.
After test the connection with the GC-100-12 i just modify the ip to 192.168.0.161, it´s the iTach ip. For my surprise i can not connect with the iTach, i tried several times without luck.
This is the code that i am using to test
#include <SPI.h>
#include <Ethernet.h>
#include <SimpleTimer.h>
SimpleTimer timer;
int forceToClose;
// Enter a MAC address and IP address for your controller below.
// The IP address will be dependent on your local network:
byte mac[] = {
0xDE, 0xAD, 0xBE, 0xEF, 0xFE, 0xED };
IPAddress ip(192,168,0,21);
// Enter the IP address of the server you're connecting to:
IPAddress server(192,168,0,161);
int rs232Feedback = 0;
// Initialize the Ethernet client library
// with the IP address and port of the server
// that you want to connect to (port 23 is default for telnet;
// if you're using Processing's ChatServer, use port 10002):
EthernetClient client;
void setup() {
// start the Ethernet connection:
Ethernet.begin(mac, ip);
// Open serial communications and wait for port to open:
Serial.begin(9600);
// give the Ethernet shield a second to initialize:
delay(1000);
Serial.println("connecting...");
// if you get a connection, report back via serial:
if (client.connect(server, 4999)) {
Serial.println("connected");
}
else {
// if you didn't get a connection to the server:
Serial.println("connection failed");
}
//forceToClose = timer.setInterval(10000, closeConnection);
}
void loop()
{
timer.run();
rs232Feedback = 0;
// if there are incoming bytes available
// from the server, read them and print them:
if (client.connect(server, 4999)) {
Serial.println("connected");
}
while (client.available()) {
char c = client.read();
Serial.print(c);
if (c=='\r'){
Serial.println("DDD");
}
}
while (Serial.available() > 0) {
char inChar = Serial.read();
if (client.connected()) {
client.print(inChar);
Serial.print("COMANDO");
}
}
if (!client.connected()) {
Serial.println();
Serial.println("disconnecting.");
client.stop();
}
//client.stop();
}
void closeConnection(){
client.stop();
Serial.println("close connection");
}
Sorry, i dont cleanup the code, but i believe that you guys will understand.
So, can someone here explain to me why i can connect with the GC-100-12 and not with the iTach ?
The ip and port are right. I tested using CommandFusion and Hercules, everything is working fine with the iTach.
Thanks for the help
Regards
Clayton