can't get data to push from xbee through ethernet shield

I’ve recently gotten the ethernet shield to work both on my home network (the 192.168.1,101) address as well as on the net (using my computer’s IP with :8081 port). I’m trying to integrate xbee, which works fine if I’m sending data from one arduino with an xbee shield to my computer (either to another xbee on a dongle to xctu monitor or onto the arduino serial monitor. When I try stacking them both, here is what happens:

on the 192.168.1.101 (home networking) the page is unavailable, and the serial monitor shows no connection attempts from client.

On the net, with my computer’s IP followed by : port number (http://108.xxx.xx.xxx:8081), the arduino serial monitor acknowledges a client:

server is at 192.168.1.101
new client
GET / HTTP/1.1
Host: 108.xxx.xx.xxx:8081
Connection: keep-alive
Cache-Control: max-age=0
Accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,/;q=0.8
User-Agent: Mozilla/5.0 (Windows NT 6.1) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/39.0.2171.99 Safari/537.36
DNT: 1
Accept-Encoding: gzip, deflate, sdch
Accept-Language: en-US,en;q=0.8

and it stops there. ON the net end, it just stays in “Waiting for…” mode and never switches to either the page or the “This page is unavailable” page.

Sketch enclosed:

#include <SPI.h>
#include <Ethernet.h>
#include <SoftwareSerial.h>
// XBee’s DOUT (TX) is connected to pin 2 (Arduino’s Software RX)
// XBee’s DIN (RX) is connected to pin 3 (Arduino’s Software TX)
SoftwareSerial XBee(2, 3); // RX, TXint ReadingNumber=0;

// Enter a MAC address and IP address for your controller below.
// The IP address will be dependent on your local network:
byte mac = {
0x90, 0xA2, 0xDA, 0x0D, 0xA8, 0x6B
};
IPAddress ip(192, 168, 1, 101);

// Initialize the Ethernet server library
// with the IP address and port you want to use
// (port 80 is default for HTTP):
EthernetServer server(8081);

void setup() {
// Open serial communications and wait for port to open:
Serial.begin(9600);
XBee.begin(9600);
while (!Serial) {
; // wait for serial port to connect. Needed for Leonardo only
}

// start the Ethernet connection and the server:
Ethernet.begin(mac, ip);
server.begin();
Serial.print("server is at ");
Serial.println(Ethernet.localIP());
}

void loop() {
// listen for incoming clients
EthernetClient client = server.available();
if (client) {
Serial.println(“new client”);
// an http request ends with a blank line
boolean currentLineIsBlank = true;
while (client.connected()) {
if (client.available()) {
char c = client.read();
Serial.write(c);
// if you’ve gotten to the end of the line (received a newline
// character) and the line is blank, the http request has ended,
// so you can send a reply
if (c == ‘\n’ && currentLineIsBlank) {
client.println(“HTTP/1.1 200 OK”);
client.println(“Content-Type: text/html”);
client.println(“Connection: close”); // the connection will be closed after completion of the response
client.println(“Refresh: 5”); // refresh the page automatically every 5 sec
client.println();
client.println("");
client.println("");
break;
}
else if (c != ‘\r’) {
// you’ve gotten a character on the current line
currentLineIsBlank = false;
}
}
}
// give the web browser time to receive the data
delay(1);
// close the connection:
client.stop();
Serial.println(“client disconnected”);
}
}

web_server_with_xbee_attempt.ino (2.6 KB)

Yikes. I somehow omitted some lines, in bold below:

#include <SPI.h>
#include <Ethernet.h>
#include <SoftwareSerial.h>
// XBee’s DOUT (TX) is connected to pin 2 (Arduino’s Software RX)
// XBee’s DIN (RX) is connected to pin 3 (Arduino’s Software TX)
SoftwareSerial XBee(2, 3); // RX, TXint ReadingNumber=0;

// Enter a MAC address and IP address for your controller below.
// The IP address will be dependent on your local network:
byte mac = {
0x90, 0xA2, 0xDA, 0x0D, 0xA8, 0x6B
};
IPAddress ip(192, 168, 1, 101);

// Initialize the Ethernet server library
// with the IP address and port you want to use
// (port 80 is default for HTTP):
EthernetServer server(8081);

void setup() {
// Open serial communications and wait for port to open:
Serial.begin(9600);
XBee.begin(9600);
while (!Serial) {
; // wait for serial port to connect. Needed for Leonardo only
}

// start the Ethernet connection and the server:
Ethernet.begin(mac, ip);
server.begin();
Serial.print("server is at ");
Serial.println(Ethernet.localIP());
}

void loop() {
// listen for incoming clients
EthernetClient client = server.available();
if (client) {
Serial.println(“new client”);
// an http request ends with a blank line
boolean currentLineIsBlank = true;
while (client.connected()) {
if (client.available()) {
char c = client.read();
Serial.write(c);
// if you’ve gotten to the end of the line (received a newline
// character) and the line is blank, the http request has ended,
// so you can send a reply
if (c == ‘\n’ && currentLineIsBlank) {
client.println(“HTTP/1.1 200 OK”);
client.println(“Content-Type: text/html”);
client.println(“Connection: close”); // the connection will be closed after completion of the response
client.println(“Refresh: 5”); // refresh the page automatically every 5 sec
client.println();
client.println("");
client.println("");

** if (XBee.available())**
** { // If data comes in from XBee, send it out to serial monitor**
** client.println(XBee.read());**
** }**
break;
}
else if (c != ‘\r’) {
// you’ve gotten a character on the current line
currentLineIsBlank = false;
}

}
}
// give the web browser time to receive the data
delay(1);
// close the connection:
client.stop();
Serial.println(“client disconnected”);
}
}