Arduino Ethernet Library Client Functions

Thank you in advance for your kind help.

I am using the Ethernet Library (client.print) to access an electronic device which supports TCP/IP.

I must send a command string to the device that contains several NULL characters. I cannot send the string since the first NULL character terminates the transmission.

I tried sending 1 byte at a time and that works when sent to a VB.NET simulator that I wrote, however, it doesn't work with the device I am trying to use. I think the device may be expecting the entire command to be contained in a single packet. I tried using a string object and that didn't work either.

I need to be able to specify the data and its length and send it as a single packet.

Can anyone out there help me ?

Thanks,

Nick

Try specifying the number of characters in the buffer:

char buffer[] = "String with a null \0 and another null \0 and that's it.";

client.write(buffer, 54);

The length parameter that you suggest is not valid according to the reference manual and does not compile.

Am I running with an old version of the ethernet library or am I doing something wrong ?

Nick

nickamen:
Am I running with an old version of the ethernet library or am I doing something wrong ?

I just looked at EtherenetClient.h from Arduino 1.0.5 and it is derived from Print so it should support the use of pointer and count:

  virtual size_t write(const uint8_t *buf, size_t size);

Maybe it doesn't like me using 'char' instead of 'uint8_t'.