OK John I see now.
The difference occurred because I pasted the code from this online tutorial http://arduino.cc/en/Tutorial/UDPSendReceiveString
I didn't realise that this example was included with the Arduino software, a silly mistake.
Does this mean that there is an error in the online tutorial?
Thanks very much for your help.