将XML消息发布到.net TCP套接字并使用PHP收集响应

I am currently posting an XML string to a TCP socket on an external server.

<?xml version='1.0'?><Data MODULE='TEST' FUNCTION='ISAVAILABLE'/>

The TCP socket is then meant to respond with a 0 or a 1 depending on the message sent.

Here is the code I am working with:

<?php
//error_reporting(0);
set_time_limit(0);

if(!($sock = socket_create(AF_INET, SOCK_STREAM, 0)))
{
    $errorcode = socket_last_error();
    $errormsg = socket_strerror($errorcode);

    die("Couldn't create socket: [$errorcode] $errormsg 
");
}

//echo "Socket created 
";

if(!socket_connect($sock , 'xxx.xxx.xxx.xxx' , 4010))
{
    $errorcode = socket_last_error();
    $errormsg = socket_strerror($errorcode);

    die("Could not connect: [$errorcode] $errormsg 
");
}

//echo "Connection established 
";

$message = "<?xml version='1.0'?><Data MODULE='TEST' FUNCTION='ISAVAILABLE'/>";

if(!socket_send( $sock , $message , strlen($message) , 0))
{
    $errorcode = socket_last_error();
    $errormsg = socket_strerror($errorcode);

    die("Could not send data: [$errorcode] $errormsg 
");
}

socket_sendto($sock, $message, strlen($message), 0, 'xxx.xxx.xxx.xxx', 4010);

//echo "Message send successfully 
";

if(socket_recv( $sock , $buf , 2048 , MSG_WAITALL ) === FALSE)
{
    $errorcode = socket_last_error();
    $errormsg = socket_strerror($errorcode);

    die("Could not receive data: [$errorcode] $errormsg 
");
echo $buf  . "
";
}   

echo  "<pre>" . $buf . "</pre>";
socket_close($sock);

The socket currently responds with a 0, but when I test the exact same method in C# it posts a 1.

My question is am I missing something or mis-using a function?

This is my first time using the socket functions so forgive my noobness when it comes to this.

Thanks