Convert PHP Code Block (fsockopen, fputs, feof, fgets) into C# : <p>I need someone to convert this php code block into equivalent C#. We are working on MT4 to register user via asp.net web application. We have been given the php version of the site to post the user information. every things is setup accordingly. however the following code block need to be converted. I tried to search online solution but could not find any documentation thanks.</p>

<pre><code>function MQ_Query($query)
{
$ret='error';
//---- open socket
$ptr=@fsockopen(T_MT4_HOST,T_MT4_PORT,$errno,$errstr,5); 
//---- check connection
 if($ptr)
 {
  //---- send request
  if(fputs($ptr,"W$query\nQUIT\n")!=FALSE)
    {
     //---- clear default answer
     $ret='';
     //---- receive answer
     while(!feof($ptr)) 
      {
       $line=fgets($ptr,128);
       if($line=="end\r\n") break; 
       $ret.= $line;
      } 
    }
  fclose($ptr);
  }
  //---- return answer
 return $ret;

 }
</code></pre>

<p>please </p>
