Can not chat in two directions using Arduino Ethernet Shield, why?

iDroid:

creativen:
I just upload code using PC1...
I'm sending message from PC2 to PC1 via Arduino, it works, but I wonder why I cannot reverse it (sending message from PC1 to PC2)
The rest is right... :wink:

Like I said, you don't have the necessary connections. Right now, you have a connection from PC2 to PC1, but not the other way around.

Danke for the response!:smiley:

So, how I can get the connection from PC1 to P2 ?

Aside from the use of the router mentioned earlier, you mean? You can't. Accept it and move on.

dxw00d:
Aside from the use of the router mentioned earlier, you mean? You can't. Accept it and move on.

So you mean if I use router, the I can do two or more way of communication?

Possibly. The Ethernet shield allows for a small number of simultaneous connections. I don't know whether the sketch allows it though. The point of the Arduino is to allow for quick experimentation. Try it and see.

creativen:

dxw00d:
Aside from the use of the router mentioned earlier, you mean? You can't. Accept it and move on.

So you mean if I use router, the I can do two or more way of communication?

Yes, but you'll probably have to modify the sketch a little.

Vielen Dank to all of you!
At least I find some hope!

creativen:
Vielen Dank to all of you!
At least I find some hope!

You're welcome.

Earlier you said that you this was just an experiment for some project.
So what are you trying to do when you have this working?

This is just the experiment to get the idea how it communicate in many ways.

Then I can use the idea to send and receive information from 7segment display the distribute it to many client using LAN...

I see, so you're aiming for some sort of system to send messages to highly trained chimps in your mansion? :smiley:

iDroid:
I see, so you're aiming for some sort of system to send messages to highly trained chimps in your mansion? :smiley:

Highly trained chimps?

creativen:

iDroid:
I see, so you're aiming for some sort of system to send messages to highly trained chimps in your mansion? :smiley:

Highly trained chimps?

Monkeys, workers.

Shouldn't have threw that joke to someone who might not get it, sorry :3

highly train chimps (workers) in my factory...

My sketch code example didn't work for you?

SurferTim:
Take a look at the code in this thread:
How to get the client(s)of an Arduino ethernet server? - #2 by SurferTim - Networking, Protocols, and Devices - Arduino Forum

It is a simple telnet type connection that works both ways. It is by no means complete, just a test. But it should give you an idea how it works. Feel free to modify it to your heart's content.

edit: That code above is a bit lacking. Try this. It is a bit better for two way comm. Change the network settings to yours. It will timeout the connected client if there is no input for about a minute.

#include <SPI.h>

#include <Ethernet.h>

byte mac[] = { 0xDE, 0xAD, 0xBE, 0xEF, 0xFE, 0xED };
IPAddress ip( 192,168,2,2 );
IPAddress gateway( 192,168,2,1 );
IPAddress subnet( 255,255,255,0 );

EthernetServer server(23);

int loopCount = 0;
boolean isStopped;

void setup()
{
  Serial.begin(9600);
  pinMode(4,OUTPUT);
  digitalWrite(4,HIGH);
  Ethernet.begin(mac, ip, gateway, gateway, subnet);
  delay(2000);
  server.begin();
  Serial.println("Ready");
}

void loop()
{
  EthernetClient client = server.available();

if(client)
  {
    Serial.println("Client connected");
    client.flush();
    isStopped = false;
    loopCount = 0;
    char c;
   
    client.println("Hello");

while(Serial.available()) Serial.read();
   
    while (client.connected())
    {
      while(client.available())
      {
        c = client.read();

if(c == 'x')
        {
          client.stop();
          Serial.println("stop - user request");
          isStopped = true;
        }
        else Serial.write(c);

loopCount = 0;
      }

delay(10);
     
      loopCount++;

if(loopCount > 10000)
      {
        client.stop();     
        Serial.println("stop - timeout");
        isStopped = true;
      }

while(Serial.available())
       {
          c =Serial.read();
          client.write(c);
          Serial.write(c);
       }
    }

if(!isStopped)
    {
      client.stop();
      Serial.println("stop - disconnect");
    }

Serial.println("disconnected");
  }
}

Hello SurferTim, oh yeah I just tested the code you gave me:
The result is my Netbook (say it PC2 --> client) can respond in telnet "Hello"
But the problem in my Notebook (say it PC1 --> server) can not open the serial monitor, what's wrong then yah?
it show red warning:

Exception in thread "AWT-EventQueue-0" java.lang.NullPointerException
	at javax.swing.BoxLayout.preferredLayoutSize(BoxLayout.java:282)
	at java.awt.Container.preferredSize(Container.java:1599)
	at java.awt.Container.getPreferredSize(Container.java:1584)
	at javax.swing.JComponent.getPreferredSize(JComponent.java:1636)
	at java.awt.BorderLayout.layoutContainer(BorderLayout.java:804)
	at java.awt.Container.layout(Container.java:1421)
	at java.awt.Container.doLayout(Container.java:1410)
	at java.awt.Container.validateTree(Container.java:1507)
	at java.awt.Container.validateTree(Container.java:1513)
	at java.awt.Container.validateTree(Container.java:1513)
	at java.awt.Container.validateTree(Container.java:1513)
	at java.awt.Container.validate(Container.java:1480)
	at java.awt.Window.show(Window.java:860)
	at java.awt.Component.show(Component.java:1563)
	at java.awt.Component.setVisible(Component.java:1515)
	at java.awt.Window.setVisible(Window.java:841)
	at processing.app.Editor.handleSerial(Editor.java:2416)
	at processing.app.Editor$18.actionPerformed(Editor.java:671)
	at javax.swing.AbstractButton.fireActionPerformed(AbstractButton.java:1995)
	at javax.swing.AbstractButton$Handler.actionPerformed(AbstractButton.java:2318)
	at javax.swing.DefaultButtonModel.fireActionPerformed(DefaultButtonModel.java:387)
	at javax.swing.DefaultButtonModel.setPressed(DefaultButtonModel.java:242)
	at javax.swing.AbstractButton.doClick(AbstractButton.java:357)
	at javax.swing.plaf.basic.BasicMenuItemUI.doClick(BasicMenuItemUI.java:1225)
	at javax.swing.plaf.basic.BasicMenuItemUI$Handler.mouseReleased(BasicMenuItemUI.java:1266)
	at java.awt.Component.processMouseEvent(Component.java:6263)
	at javax.swing.JComponent.processMouseEvent(JComponent.java:3267)
	at java.awt.Component.processEvent(Component.java:6028)
	at java.awt.Container.processEvent(Container.java:2041)
	at java.awt.Component.dispatchEventImpl(Component.java:4630)
	at java.awt.Container.dispatchEventImpl(Container.java:2099)
	at java.awt.Component.dispatchEvent(Component.java:4460)
	at java.awt.LightweightDispatcher.retargetMouseEvent(Container.java:4574)
	at java.awt.LightweightDispatcher.processMouseEvent(Container.java:4238)
	at java.awt.LightweightDispatcher.dispatchEvent(Container.java:4168)
	at java.awt.Container.dispatchEventImpl(Container.java:2085)
	at java.awt.Component.dispatchEvent(Component.java:4460)
	at java.awt.EventQueue.dispatchEvent(EventQueue.java:599)
	at java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:269)
	at java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:184)
	at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:174)
	at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:169)
	at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:161)
	at java.awt.EventDispatchThread.run(EventDispatchThread.java:122)

Does the notebook have the Arduino USB connection?

@creativen: Have you used the serial monitor successfully before? If you have trouble with that, you can also use PuTTY (a terminal program) or HyperTerminal.

edit: Also remember the Arduino is normally reset when you connect to the serial port with a terminal program. If there are any connections active on the w5100, they will be thrown off.

If you want to disable that feature, there is a pair of small pads labeled "reset en" on the Uno/Mega circuit board. There is a very small trace between those pads. If you cut the trace, the Arduino will not reset when you connect with a terminal program. However, you will now be required to press the reset button on the Arduino/shield during the program upload to start the bootloader. Solder them back together, and it returns to resetting the Arduino.

dxw00d:
Does the notebook have the Arduino USB connection?

Sure the notebook has usb cable to arduino UNO.
The netbook doesn't..it only connect to arduino ethernet shield via RJ 45 cable

@creativen: Have you used the serial monitor successfully before? If you have trouble with that, you can also use PuTTY (a terminal program) or HyperTerminal.

edit: Also remember the Arduino is normally reset when you connect to the serial port with a terminal program. If there are any connections active on the w5100, they will be thrown off.

If you want to disable that feature, there is a pair of small pads labeled "reset en" on the Uno/Mega circuit board. There is a very small trace between those pads. If you cut the trace, the Arduino will not reset when you connect with a terminal program. However, you will now be required to press the reset button on the Arduino/shield during the program upload to start the bootloader. Solder them back together, and it returns to resetting the Arduino.

Yes, I had used the serial monitor successfully before...It can show what I am typing in my netbook(in telnet terminal)...it could not send any string to the netbook (telnet terminal), so whatever I type in the serial monitor, will not appear in the netbook.
But now the serial monitor even can not appear due to the red warning.

The netbook doesn't..it only connect to arduino ethernet shield via RJ 45 cable

Hope it is a crossover cable. I just got an Acer Aspite One (11.3") and will connect my arduino soon to see how well it works.

zoomkat:

The netbook doesn't..it only connect to arduino ethernet shield via RJ 45 cable

Hope it is a crossover cable. I just got an Acer Aspite One (11.3") and will connect my arduino soon to see how well it works.

I use straight cable, but it works when I had used it to activate WORKGROUP where we can share folder from many computers.
What will you connect to your Arduino?Crossover cable? do you use ethernet shield? or you mean usb cable to connect your acer aspite one to the arduino?