Arduino UDP Ethernet PHP Problem

Hey guys, I'm pretty new to Arduino so if what I ask may sound dumb, you know why :stuck_out_tongue:

I have been working on a project where I send the values from the Arduino Analog Pins to a PHP application. I need to send the status of 5 Analog Inputs. My code works okay for upto three Analog Inputs where afterwards I get a error on my web app saying "Warning: socket_recvfrom() [function.socket-recvfrom]: unable to recvfrom [0]:"
This happens (by the looks of it) when the number of characters I send are above a certain number. However if I pass a string it works like a charm.

I really need HELP :frowning: Thanks in advance.

PS. Here's my code

#include <SPI.h>
#include <Ethernet.h>
#include <EthernetUdp.h>                 //UDP library from: bjoern@cs.stanford.edu 12/30/2008


//MAC and IP addresses for the Arduino
byte mac[] = {0xDE, 0xAD, 0xBE, 0xEF, 0xFE, 0xED};
IPAddress ip(192, 168, 1, 171);

//Global variables
IPAddress ip_remote(192,168,1,3);        //IP address of the remote location
unsigned int port_remote = 1235;         //Outgoing PORT
unsigned int localPort = 8801;           //Incoming PORT

char packetBuffer[50];                   //Buffer to hold incoming packet (50 characters MAX)
char charBuf[100];                       //Buffer to hold the switch states (50 characters MAX)

//An EthernetUDP instance to let us send and receive packets over UDP
EthernetUDP Udp;


void setup() {
  //Start the Ethernet and UDP:
  Ethernet.begin(mac,ip);
  Udp.begin(localPort);
  
  //Digital PINS 22-26 are INPUTS
  pinMode(22, INPUT);
  pinMode(23, INPUT);
  pinMode(24, INPUT);
  pinMode(25, INPUT);
  pinMode(26, INPUT);
  //Digital PINS 27-36 are OUTPUTS
  pinMode(27, OUTPUT);
  pinMode(28, OUTPUT);
  pinMode(29, OUTPUT);
  pinMode(30, OUTPUT);
  pinMode(31, OUTPUT);
  pinMode(32, OUTPUT);
  pinMode(33, OUTPUT);
  pinMode(34, OUTPUT);
  pinMode(35, OUTPUT);
  pinMode(36, OUTPUT);

  Serial.begin(9600);                    //Serial communication mainly for debugging
}


void loop() {
  //If there's data available, read a packet
  int packetSize = Udp.parsePacket();
  
  String stringOne = "";
  
  stringOne += analogRead(A0);
  stringOne += analogRead(A1);
  stringOne += analogRead(A2);
  stringOne += analogRead(A3);
  
  

  stringOne.toCharArray(charBuf, 100);
  
  //Send a packet to the Remote IP on the specified PORT 
  Udp.beginPacket(ip_remote, port_remote);
  Udp.write(charBuf);
  Udp.endPacket();
    
    
  if(packetSize)
  {
    Serial.print("Received packet of size ");
    Serial.println(packetSize);
    Serial.print("From ");
    IPAddress remote = Udp.remoteIP();
    for (int i =0; i < 4; i++)
    {
      Serial.print(remote[i], DEC);
      if (i < 3)
      {
        Serial.print(".");
      }
    }
    Serial.print(", port ");
    Serial.println(Udp.remotePort());

    //Read the packet into packetBufffer
    Udp.read(packetBuffer, 50);                  //50 is the size of the buffer
    Serial.println("Contents:");
    Serial.println(packetBuffer);
  }
  delay(1000);
}

GUYS! I figured out the problem, it was my PHP code. Sorry if this was a misleading post