Zawislak:
Okay i will send pictures of what you asking. I can switch between UDP and TCP in Omron Software, below there is a screen of TCP setting and working case when i do an inspection and in TCPIPbuilder i see the logs. In "Connection setup" the ip was set : 10.5.5.10 and port 9876 ( adress of FQ2). 10.5.5.101 is my network card ip and 65207 was set randomly. The code i tried:
#include <SPI.h>
#include <Ethernet2.h>
// network configuration. gateway and subnet are optional.
// the media access control (ethernet hardware) address for the shield:
byte mac[] = { 0x00, 0x00, 0x0A, 0x75, 0x81, 0x0C };
//the IP address for the shield:
byte ip[] = { 10, 5, 5, 10 };
// the router's gateway address:
byte gateway[] = { 10, 5, 5, 10 };
// the subnet:
byte subnet[] = { 255, 255, 255, 0 };
// telnet defaults to port 23
EthernetServer server = EthernetServer(9876);
void setup()
{
// initialize the ethernet device
Ethernet.begin(mac, ip, gateway, subnet);
// start listening for clients
server.begin();
}
void loop()
{
// if an incoming client connects, there will be bytes available to read:
EthernetClient client = server.available();
if (client == true) {
// read bytes from the incoming client and write them back
// to any clients connected to the server:
server.write(client.read());
}
}


Okay so that's my code:
#include <Ethernet2.h>
#include <SPI.h>
byte mac[] = { 0xBC, 0x5F, 0xF4, 0xD2, 0xDC, 0x2A }; //Mac of the camera
byte ip[] = { 10, 5, 5, 101 }; //ip of pc ethernet card
byte server[] = { 10, 5, 5, 10 }; //ip of server (camera)
int tcp_port = 9876; //port of the server (camerA)
EthernetClient client;
void setup() {
Ethernet.begin(mac, ip);
Serial.begin(9600);
delay(1000);
Serial.println("Connecting...");
if (client.connect(server, tcp_port)) {
Serial.println("Connected");
client.println();
} else{
Serial.println("Error");
}
}
void loop() {
if (client.available()) {
if(Serial.available()) {
char s = Serial.read();
client.write(s);
char c = client.read();
Serial.print(c);
}
}
if (!client.connected()) {
Serial.println();
Serial.println("Disconecting.");
client.stop();
for(;;);
}
}
I tried with mac adress of my ethernet card also (which one should it be?).
I get the messages:
13:54:54.851 -> Connecting...
13:54:54.897 -> Error
13:54:54.897 ->
13:54:54.897 -> Disconecting
Any thoughts?