Transfer byte-buffer with ENC28J60 How do I transfer a series of byte[256]-buffers to a server with an ENC28J60 Ethernet adapter? I get blocks of uint8_t from an Arducam camera module and I'd like to transfer them to a host. Does somebody have an idea how to solve that? I asked a previous question regarding that topic but now new issues arrived.

This is how the array is filled:

uint8_t temp = 0, temp_last = 0;
byte buf[256];
length = myCAM.read_fifo_length();
while (length--) {
  temp_last = temp;
  temp =  SPI.transfer(0x00);
  if ((temp == 0xD9) &amp;&amp; (temp_last == 0xFF)) {
    buf[i++] = temp;
    is_header = false;
    i = 0;
  }
  if (is_header == true) {
    //Write image data to buffer if not full
    if (i &lt; 256)
      buf[i++] = temp;
    else {
      i = 0;
      buf[i++] = temp;
    }
  }
}
Assuming you are using the EtherCard library you can send a UDP packet with:

ether.sendUdp(packet_data, length, srcPort, hisip, dstPort );   


Assuming you have already set up your source port and have the destination IP address and port in hisip and dstPort.

The prototype for the function is:

void sendUdp (char *data,uint8_t len,uint16_t sport, uint8_t *dip, uint16_t dport);


The example udpClientSendOnly.ino with the library shows you UDP sending in action.