user-1: is it possible to connect Arduino Ethernet Shield direct to PC and send a String variable? How can I read it later on the PC?
Will this code work?
#include <Ethernet.h>
#include <SPI.h>

byte mac[] = { 0x00, 0xAA, 0xBB, 0xCC, 0xDE, 0x02 }; // Shield MAC

byte pc[] = "192.168.0.13"; // pc IP
EthernetClient client;

void setup()
{
  Ethernet.begin(mac);
  Serial.begin(9600);

  Serial.println("connecting...");

  delay(5000);
  if (client.connect(server, 80)) {
    Serial.println("connected");
    client.println("Sample String");
    client.println();
  } else {
    Serial.println("connection failed");
  }

}

void loop()
{

}


user881: No, you seem to be off on a tangent. There at least two problems:

The Ethernet library is designed to run on an Arduino board. If you set the IP address to the same as the PC IP address, the network will get confused and nothing will work reliably.
Are you asking how one can publish data from an Arduino board and read the results on a PC? This is easier. Just set up the web server example on the Arduino, and access it from a browser on your PC.


-1: <p>is it possible to connect Arduino Ethernet Shield direct to PC and send a String variable? How can I read it later on the PC?</p>

<p>Will this code work?</p>

<pre><code>#include &lt;Ethernet.h&gt;
#include &lt;SPI.h&gt;

byte mac[] = { 0x00, 0xAA, 0xBB, 0xCC, 0xDE, 0x02 }; // Shield MAC

byte pc[] = "192.168.0.13"; // pc IP
EthernetClient client;

void setup()
{
  Ethernet.begin(mac);
  Serial.begin(9600);

  Serial.println("connecting...");

  delay(5000);
  if (client.connect(server, 80)) {
    Serial.println("connected");
    client.println("Sample String");
    client.println();
  } else {
    Serial.println("connection failed");
  }

}

void loop()
{

}
</code></pre>
 881: <p>No, you seem to be off on a tangent. There at least two problems:</p>

<ol>
<li>The Ethernet library is designed to run on an Arduino board. If you set the IP address to the same as the PC IP address, the network will get confused and nothing will work reliably.</li>
<li>Are you asking how one can publish data from an Arduino board and read the results on a PC? This is easier. Just set up the web server example on the Arduino, and access it from a browser on your PC.</li>
</ol>
