Sensors values received by Ethernet on computer without shield

Hello,

I'm struggling with ethernet communication to receive values from an arduino nano.
Here is the full installation for context :

I'm using an Xbox controller to control some actuators with Processing (pde) and Arduino.
But I need info from other sensors connected by a long Ethernet cable.
Those sensors, just some micro switch to detect contact, are connected to an arduino nano and an ethernet shield ( ENC28J60). I also need an ethernet camera which explains the ethernet switch.

Here's the program on the Arduino nano :

#include <UIPEthernet.h>  // ENC28J60

const int Contact1 = 5;
const int Contact3 = 3;
const int Contact2 = 4;

byte mac[] = { 0xDE, 0xAD, 0xBE, 0xEF, 0xFE, 0xED };
IPAddress ip(192, 168, 1, 115);  // Address IP Arduino
IPAddress server(192, 168, 1, 100);  // Address IP PC
const int port = 8000;  // Port
EthernetClient client;

int state1 = 0;
int state2 = 0;
int state3 = 0;

void setup() {
  pinMode(Contact1, INPUT_PULLUP);
  pinMode(Contact3, INPUT_PULLUP);
  pinMode(Contact2, INPUT_PULLUP);

  Serial.begin(9600);
  Ethernet.begin(mac, ip);
  delay(1000);

  Serial.println("Connection ...");
  if (client.connect(server, port)) {
    Serial.println("Connected ! ");
  } else {
    Serial.println("Connection failed");
  }
}

void loop() {

  // contacts
  state1 = !(digitalRead(Contact1));
  state2 = !(digitalRead(Contact3));
  state3 = !(digitalRead(Contact2));

  Serial.print(state1);
  Serial.print(state2);
  Serial.println(state3);

  if (client.connected()) {
    client.print("Contact: "); client.print(state1); client.print(state2); client.println(state3);

  } else {
    Serial.println("Connection lost");
    if (client.connect(server, port)) {
      Serial.println("Reconnected !");
    }
  }
}

My goal is to use the sensors values received by ethernet on my computer on an arduino program to pilot the arduino mega. Is it possible ? Do you have some idea on how to do it ? Maybe it's a trivial problem but I haven't found any answer yet.

Thank you in advance !

I don't understand (see pic) why you have a Mega talking to an Arduino. Why not just replace the Arduino with the Mega?

Yes sorry, it's a bit confusing, there is only one Arduino. I wanted to schematize the fact that the Arduino Mega is always connected to the computer by USB and that both software Arduino and Processing are used. (so the "Arduino" on top is the software and the one at the bottom is the hardware)

Ok, there is no need then to have that Arduino in the Computer box. I assume the Computer is a Windows PC?
What is the box inside the computer labelled 'Processing'?

Will there be a PC program that talks to the ethernet as well as the USB to the Mega and Bluetooth to the Xbox controller?

Yes I use a Windows PC.
In the box labelled "Processing", it's the software Processing. Processing and Arduino communicate by serial.

The best solution, if possible, would be to read the data received by ethernet on the main arduino code. But if it's not possible, having a pc program is a option.

I have found a solution, I use the arduino nano with a shield as an ethernet client and i create a server with Processing. And processing send the value to Arduino over serial.