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(;;)
;
}
}