Arduino capture text and resend out Ethernet

I have a need to print to an arduino usb port and have it resend the text to a TCP server. I have a program and want to send process info to the "main office". My thought is to have it print to the arduino. I installed the arduino on a win xp machine told the pc it was a genric text only printer. Then i set the arduino to resend to "TCP Server". As a test I used Hercules SETUP Utility by HW-group.com to catch it. The problem is that when i send a test print page it only captures about 2 sentences in the middle of the page. I am using a Sparkfun Arduino Pro Ethernet with a FTDI Basic.

Below is my sketch. What am I missing. The text that i want to send is about a paragraph worth the text at a time every couple minutes. Because of the software on the PC for the Process I think this is the easiest way to get info out of it with out modifying the program.

Any help or ideas wold be great!!

#include <SPI.h>
#include <Ethernet.h>

byte mac[] = { 0xDE, 0xAD, 0xBE, 0xEF, 0xFE, 0xED };
byte ip[] = { 192,168,1,177 };
byte server[] = { 192,168,1,3 }; 

Client client(server, 7000);

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

   delay(1000);

   if (client.connect()) {
      client.println("Connected");
      client.println();
   } 
}

void loop()
{
   if (client.available()) {
      char c = client.read();
      Serial.print(c);
   }
   
   if (Serial.available() > 0) {
     char incomingByte = Serial.read();
    client.print(incomingByte);
     delay(3);    //wait for whole message
   }
   

   if (!client.connected()) {
      client.stop();
      for(;;)
         ;
   }
}

The problem is that when i send a test print page it only captures about 2 sentences in the middle of the page. I am using a Sparkfun Arduino Pro Ethernet with a FTDI Basic.

The first problem you may be encountering is that when the serial port on the pc is opened up, the arduino resets (DTR blips high), probably resulting in the first part of the message being lost. I think the same thing happens when the serial port is closed. You can defeat the reset on a regular arduino board by putting a 100 ohm resistor between the reset pin and the +5v pin after the code has been uploaded to the arduino.

Thank You so much. I had thought that it was resetting but had no idea why. I put the resistor in and took the delay out and it works great.

Thanks

Which delay did you remove?

the second delay.

 delay(3);    //wait for whole message

It was skipping characters.