Pages: [1]   Go Down
Author Topic: Arduino Ethernet board and Telnet  (Read 796 times)
0 Members and 1 Guest are viewing this topic.
Offline Offline
Jr. Member
Karma: 1
Posts: 55
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

I've been trying to talk to an Arduino Ethernet board (not shield)
with telnet, and have go nowhere; thanks to this forum I've got
ping running, but the telnet or udp or web stuff I want to add
simply hangs.  Below is the sketch I've been trying - it runs ok
(without handling telnet) until the EthernetClient line is added,
and then it hangs - no response to ping, nothing on the serial port.

I'm using arduino-1.0.1 and avr-gcc-4.5.3 (on Linux).  It looks as
if the Ethernet library is blocking somewhere, but following through
a maze of C++ class initialisations isn't easy.  Can anyone see
where I might be going wrong, or suggest a working library?

Thanks - Will

// Test of Arduino Telnet.
#include <SPI.h>
#include <Ethernet.h>

// Undefine this to get a working program.
#undef TELNET

// the media access control (ethernet hardware) address for the Arduino:
byte mac[] = { 0x90, 0xA2, 0xDA, 0x00, 0x92, 0x34 };

// the IP address for the Arduino:
byte ip[] = { 192, 168, 1, 20 };

// telnet defaults to port 23
EthernetServer server(23);

void setup()
  // Initialise the serial device.

  // Initialize the ethernet device
  Ethernet.begin(mac, ip);

  // start listening for clients

void loop()
  // Uncommenting this statement hangs the sketch.
  // The response from ICMP is "Destination Host Unreachable"
  EthernetClient client = server.available();

  // Read bytes from the incoming client and write them back
  // to any clients connected to the server.
#ifdef TELNET
  if (client) {
    char c =;

// eof
« Last Edit: April 03, 2012, 04:02:16 pm by cwrose » Logged

Global Moderator
Offline Offline
Shannon Member
Karma: 221
Posts: 13848
In theory there is no difference between theory and practice, however in practice there are many...
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

please modify your post, select the code and press the # butto to get it proper tagged , makes it easier to read.

seen this thread on the old forum - - ?

Rob Tillaart

Nederlandse sectie -,77.0.html -
(Please do not PM for private consultancy)

Pages: [1]   Go Up
Jump to: