[Mono-list] System.Net.Sockets.SocketException

Timothy Parez tpsoftware@users.sourceforge.net
Thu, 20 Mar 2003 00:19:17 +0100


This is a multi-part message in MIME format.

------=_NextPart_000_0014_01C2EE76.58548180
Content-Type: text/plain;
	charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable

Update 2:
The error doesn't seem to be gone at all :(
So the problem remains.
  ----- Original Message -----=20
  From: Timothy Parez=20
  To: mono-list@ximian.com=20
  Sent: Wednesday, March 19, 2003 11:52 PM
  Subject: Re: [Mono-list] System.Net.Sockets.SocketException


  Update:

  It seems that when I changed everything to ASCII instead of UTF7 =
everything works fine and there are no more socket exceptions. Although =
I don't get the link between the encoding and the socket exceptions, so =
it may be co=EFncidence.

  Can someone verify this ?
    ----- Original Message -----=20
    From: Timothy Parez=20
    To: mono-list@ximian.com=20
    Sent: Wednesday, March 19, 2003 11:08 PM
    Subject: [Mono-list] System.Net.Sockets.SocketException


    Hi,

    I'm writing a set of class libs for .NET/Mono,
    except for the UTF7 Encoding in my other post, it should work fine.
    And it does on .NET, but not on Mono.

    I don't know where to start, but I'll try to explain.

    First of all I have a Base Class which amongst other members has the =
following function

     private void ExecuteQuery()
      {
       UdpClient client =3D new UdpClient();
       //Connect to the server and send the query data
       try
       {
        client.Connect(ip,port);
        client.Send(data,data.Length);
       }
       catch
       {
        client.Close();
        throw new Exceptions.InvalidHostException("Unknown host: " + =
ip);
       }

       //Listen for a response - This is the client side
       IPEndPoint serverIPEndPoint =3D new IPEndPoint(IPAddress.Any,0);
      =20
       //Receive the response
       try
       {
        queryResponse =3D client.Receive(ref serverIPEndPoint);
       }
       catch (Exception e)
       {
        throw new Exceptions.ConnectionRefusedException("The connection =
was refused by the remote host: " + ip + ":" + port.ToString() + "\n" + =
e.Message,e);
       }
       finally
       {
        client.Close();
       }
      }

    As you can see it sends a n array of bytes to the server and =
receives some in return.

    Then I have a derived class which has 2 important functions:

      public string RequestStatus()
      {
       //Create the byte[] array to send
       byte[] query =3D =
{0xFF,0xFF,0xFF,0xFF,0x67,0x65,0x74,0x73,0x74,0x61,0x74,0x75,0x73,0xA};
      =20
       //Create a new separator
       char separator =3D Convert.ToChar(10);

       //A statusRequest consists of both rules and players separated by =
char(10)
       string[] response =3D this.QueryToString(query).Split(separator);
      =20
       //Get the rules and players
       string rules =3D this.RulesToXml(response[0]);
       string players =3D this.PlayersToXml(response);
     =20
       return =
this.CreateXmlBody("Quake3","statusRequest",string.Concat(rules,players))=
;
      }

    And

      public string RequestInfo()
      {
       //Create the byte[] array to send
       byte[] query =3D =
{0xFF,0xFF,0xFF,0xFF,0x67,0x65,0x74,0x69,0x6E,0x66,0x6F,0xA};
      =20
       //Query the server and get the response in a string
       string response =3D this.QueryToString(query);
      =20
       //Create the default xml body and put the rules in it
       string returnValue =3D =
this.CreateXmlBody("Quake3","infoRequest",this.RulesToXml(response));

       //return the XML
       return returnValue;
      }

    As you can see there is almost no difference between them.
    Now they both run fine with the .NET runtime, but with the mono =
runtime the .RequestStatus() fails.

    When does it fail well when the QueryToString function is called,
    so if I run RequestInfo() the QueryToString function is called and =
it all works fine,
    if I run RequestStatus() the QueryToString function is called and it =
goes wrong.
    In my opinion the only difference so far is the array of bytes to be =
sent.

    Example:

    Let's say I use the following code for an application

    using System;
    using TPSoftware.Q3PlugsNet;
    using TPSoftware.Q3PlugsNet.Exceptions;

    class MainClass
    {
     public static void Main(string[] args)
     {
         =20
      //Create a new Q3Query
    =20
     // Q3Query quakeClient =3D new Q3Query("195.130.132.153",27961);
      Q3Query quakeClient =3D new Q3Query("195.130.132.155",27961);
     =20
      try
      {
       string info =3D quakeClient.RequestStatus();
       Console.WriteLine(info);
      }
      catch (Exception e)
      {
       Console.WriteLine("ERROR:");
       Console.WriteLine("\n" + e.ToString());         =20
               =20
      }
      finally
      {
      Console.ReadLine();
      }
     }
    }

    Well then I get the following result with .NET runtime

    <?xml version=3D"1.0" encoding=3D"utf-7" =
standalone=3D"yes"?><Q3Plugs.NET><Query type=3D
    "statusRequest" protocol=3D"Quake3"><Server =
ipadress=3D"195.130.132.155" port=3D"27961
    " /><Rules count=3D"28"><rule =
name=3D"capturelimit"><![CDATA[8]]></rule><rule name=3D"
    sv_floodProtect"><![CDATA[0]]></rule><rule =
name=3D"sv_maxPing"><![CDATA[0]]></rule
    ><rule name=3D"sv_minPing"><![CDATA[0]]></rule><rule =
name=3D"sv_maxRate"><![CDATA[15
    000]]></rule><rule name=3D"sv_punkbuster"><![CDATA[0]]></rule><rule =
name=3D"sv_maxcl
    ients"><![CDATA[14]]></rule><rule =
name=3D"sv_hostname"><![CDATA[Telenet Q3A OSP CA
     Server]]></rule><rule name=3D"timelimit"><![CDATA[0]]></rule><rule =
name=3D"fraglimi
    t"><![CDATA[25]]></rule><rule =
name=3D"dmflags"><![CDATA[8]]></rule><rule name=3D"ver
    sion"><![CDATA[Q3 1.32 linux-i386 Oct  7 2002]]></rule><rule =
name=3D"g_gametype"><
    ![CDATA[5]]></rule><rule =
name=3D"protocol"><![CDATA[68]]></rule><rule name=3D"mapnam
    e"><![CDATA[q3dm6]]></rule><rule =
name=3D"sv_privateClients"><![CDATA[2]]></rule><r
    ule name=3D"sv_allowDownload"><![CDATA[1]]></rule><rule =
name=3D"server_promode"><![C
    DATA[0]]></rule><rule name=3D"server_cq3"><![CDATA[0]]></rule><rule =
name=3D"g_needpa
    ss"><![CDATA[0]]></rule><rule =
name=3D"server_ospauth"><![CDATA[2]]></rule><rule na
    me=3D"gamename"><![CDATA[osp]]></rule><rule =
name=3D"gameversion"><![CDATA[OSP v1.03]
    ]></rule><rule name=3D"Players_Red"><![CDATA[2 4 6 8 10 =
]]></rule><rule name=3D"Play
    ers_Blue"><![CDATA[1 3 5 7 9 ]]></rule><rule =
name=3D"Score_Red"><![CDATA[15]]></ru
    le><rule name=3D"Score_Blue"><![CDATA[17]]></rule><rule =
name=3D"Score_Time"><![CDATA
    [Round 33/49]]></rule></Rules><Players count=3D"10"><Player =
score=3D"20" ping=3D"15"><
    ![CDATA["^5DA^4.^5Ch^7a^5o^7s"]]></Player><Player score=3D"12" =
ping=3D"24"><![CDATA[
    "UnnamedPlaye^1r"]]></Player><Player score=3D"48" =
ping=3D"38"><![CDATA["^b^0*^n^7mnl
    ^b^0*"]]></Player><Player score=3D"38" =
ping=3D"38"><![CDATA["^xffffff^9eHk^b^4*^n^0T
    ^9N^0T"]]></Player><Player score=3D"80" =
ping=3D"25"><![CDATA["^5B^7osje^5R"]]></Play
    er><Player score=3D"85" =
ping=3D"24"><![CDATA["^x00FF00^2911^xFFFFFF^0>>^7SaTo"]]></P
    layer><Player score=3D"18" =
ping=3D"52"><![CDATA["^4jerome"]]></Player><Player score=3D
    "96" =
ping=3D"41"><![CDATA["^x3366FF^7e^0C^7'.E^0mo^7Z"]]></Player><Player =
score=3D"1
    1" ping=3D"16"><![CDATA["crypto"]]></Player><Player score=3D"73" =
ping=3D"40"><![CDATA[
    "^0fearl^33^0ss"]]></Player></Players></Query></Q3Plugs.NET>

    But I get the following with the mono runtime:

    Unhandled Exception: =
TPSoftware.Q3PlugsNet.Exceptions.ConnectionRefusedException
    : The connection was refused by the remote host: =
195.130.132.155:27961
    Some sort of w32 error occurred ---> =
System.Net.Sockets.SocketException: Some so
    rt of w32 error occurred
    in (unmanaged) 06 System.Net.Sockets.Socket:RecvFrom_internal =
(intptr,byte[],int
    ,int,System.Net.Sockets.SocketFlags,System.Net.SocketAddress&)
    in <0x00004> 06 System.Net.Sockets.Socket:RecvFrom_internal =
(intptr,byte[],int,i
    nt,System.Net.Sockets.SocketFlags,System.Net.SocketAddress&)
    in <0x00155> 00 System.Net.Sockets.Socket:ReceiveFrom =
(byte[],int,int,System.Net
    .Sockets.SocketFlags,System.Net.EndPoint&)
    in <0x00180> 00 System.Net.Sockets.Socket:ReceiveFrom =
(byte[],int,int,System.Net
    .Sockets.SocketFlags,System.Net.EndPoint&)
    in <0x0002a> 00 System.Net.Sockets.Socket:ReceiveFrom =
(byte[],System.Net.EndPoin
    t&)
    in <0x000af> 00 System.Net.Sockets.UdpClient:Receive =
(System.Net.IPEndPoint&)
    in <0x0016b> 00 TPSoftware.Q3PlugsNet.QueryBase:ExecuteQuery ()
    --- End of inner exception stack trace ---

    in <0x002b4> 00 TPSoftware.Q3PlugsNet.QueryBase:ExecuteQuery ()
    in <0x0005b> 01 System.MulticastDelegate:invoke_void ()


    However if I change the above code to:

    using System;
    using TPSoftware.Q3PlugsNet;
    using TPSoftware.Q3PlugsNet.Exceptions;

    class MainClass
    {
     public static void Main(string[] args)
     {
         =20
      //Create a new Q3Query
    =20
     // Q3Query quakeClient =3D new Q3Query("195.130.132.153",27961);
      Q3Query quakeClient =3D new Q3Query("195.130.132.155",27961);
     =20
      try
      {
       string info =3D quakeClient.RequestInfo(); // RequestInfo instead =
of RequestStatus !!!!!!!!
       Console.WriteLine(info);
      }
      catch (Exception e)
      {
       Console.WriteLine("ERROR:");
       Console.WriteLine("\n" + e.ToString());         =20

               =20
      }
      finally
      {
      Console.ReadLine();
      }
     }
    }

    I get the following output with .NET

    <?xml version=3D"1.0" encoding=3D"utf-7" =
standalone=3D"yes"?><Q3Plugs.NET><Query type=3D
    "infoRequest" protocol=3D"Quake3"><Server =
ipadress=3D"195.130.132.155" port=3D"27961"
    /><Rules count=3D"9"><rule name=3D"game"><![CDATA[osp]]></rule><rule =
name=3D"punkbuste
    r"><![CDATA[0]]></rule><rule name=3D"pure"><![CDATA[1]]></rule><rule =
name=3D"gametyp
    e"><![CDATA[5]]></rule><rule =
name=3D"sv_maxclients"><![CDATA[12]]></rule><rule nam
    e=3D"clients"><![CDATA[2]]></rule><rule =
name=3D"mapname"><![CDATA[q3dm6]]></rule><ru
    le name=3D"hostname"><![CDATA[Telenet Q3A OSP CA =
Server]]></rule><rule name=3D"proto
    col"><![CDATA[68]]></rule></Rules></Query></Q3Plugs.NET>

    And the following output with mono (don't mind the encoding, that's =
another bug)

    ???xml version???1.0?? encoding???utf-7?? standalone???yes???? =
??Q3Plugs.NET? ??
    Query type???infoRequest?? protocol???Quake3??? ??Server =
ipadress???195.130.132.
    155?? port???27961?? /? ???Rules count????+BDJAAARO????? =
name?????+BDJAAARO???+E
    JwMQFQE+AFs-osp???+-???/rule???+QAA-rule =
name???????+BDJAAARO???+EJwMQFQE+AFs-0?
    ??+-???/rule???+QAA-rule =
name?????+BDJAAARO???+EJwMQFQE+AFs-1???+-???/rule???+QA
    A-rule =
name??????+BDJAAARO???+EJwMQFQE+AFs-5???+-???/rule???+QAA-rule =
name????+B
    G8AAA-maxclients???+AAAETEEl???+-AFs-12???+-???/rule???+QAA-rule =
name??????+BDJA
    AARO???+EJwMQFQE+AFs-2???+-???/rule???+QAA-rule =
name??????+BDJAAARO???+EJwMQFQE+
    AFs-q3dm6???+-???/rule???+QAA-rule =
name??????+BDJAAARO???+EJwMQFQE+AFs-Telenet Q
    3A OSP CA Server???+-???/rule???+QAA-rule =
name??????+BDJAAARO???+EJwMQFQE+AFs-68
    ???+-???/rule???+QAA-/Rules?????/Query? ??/Q3Plugs.NET?

    So this works fine (more or less) and doesn't throw any errors.

    So my question: Why does RequestStatus cause an error while =
RequestInfo does not.

    If you want to view the full sources of the library please visit:
    http://cvs.sourceforge.net/cgi-bin/viewcvs.cgi/q3plugs/Q3Plugs.NET/

    Thnx,
    Timothy P.




    ---
    Outgoing mail is certified Virus Free.
    Checked by AVG anti-virus system (http://www.grisoft.com).
    Version: 6.0.463 / Virus Database: 262 - Release Date: 17/03/2003


    ---
    Outgoing mail is certified Virus Free.
    Checked by AVG anti-virus system (http://www.grisoft.com).
    Version: 6.0.463 / Virus Database: 262 - Release Date: 18/03/2003
------=_NextPart_000_0014_01C2EE76.58548180
Content-Type: text/html;
	charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD>
<META http-equiv=3DContent-Type content=3D"text/html; =
charset=3Diso-8859-1">
<META content=3D"MSHTML 6.00.2800.1106" name=3DGENERATOR>
<STYLE></STYLE>
</HEAD>
<BODY bgColor=3D#ffffff>
<DIV><FONT face=3DArial size=3D2>Update 2:</FONT></DIV>
<DIV><FONT face=3DArial size=3D2>The error doesn't seem to be gone at =
all=20
:(</FONT></DIV>
<DIV><FONT face=3DArial size=3D2>So the problem remains.</FONT></DIV>
<BLOCKQUOTE dir=3Dltr=20
style=3D"PADDING-RIGHT: 0px; PADDING-LEFT: 5px; MARGIN-LEFT: 5px; =
BORDER-LEFT: #000000 2px solid; MARGIN-RIGHT: 0px">
  <DIV style=3D"FONT: 10pt arial">----- Original Message ----- </DIV>
  <DIV=20
  style=3D"BACKGROUND: #e4e4e4; FONT: 10pt arial; font-color: =
black"><B>From:</B>=20
  <A title=3Dtpsoftware@users.sourceforge.net=20
  href=3D"mailto:tpsoftware@users.sourceforge.net">Timothy Parez</A> =
</DIV>
  <DIV style=3D"FONT: 10pt arial"><B>To:</B> <A =
title=3Dmono-list@ximian.com=20
  href=3D"mailto:mono-list@ximian.com">mono-list@ximian.com</A> </DIV>
  <DIV style=3D"FONT: 10pt arial"><B>Sent:</B> Wednesday, March 19, 2003 =
11:52=20
  PM</DIV>
  <DIV style=3D"FONT: 10pt arial"><B>Subject:</B> Re: [Mono-list]=20
  System.Net.Sockets.SocketException</DIV>
  <DIV><BR></DIV>
  <DIV><FONT face=3DArial size=3D2>Update:</FONT></DIV>
  <DIV><FONT face=3DArial size=3D2></FONT>&nbsp;</DIV>
  <DIV><FONT face=3DArial size=3D2>It seems that when I changed =
everything to ASCII=20
  instead of UTF7 everything works fine and there are no more socket =
exceptions.=20
  Although I don't get the link between the encoding and the socket =
exceptions,=20
  so it may be co=EFncidence.</FONT></DIV>
  <DIV><FONT face=3DArial size=3D2></FONT>&nbsp;</DIV>
  <DIV><FONT face=3DArial size=3D2>Can someone verify this =
?</FONT></DIV>
  <BLOCKQUOTE dir=3Dltr=20
  style=3D"PADDING-RIGHT: 0px; PADDING-LEFT: 5px; MARGIN-LEFT: 5px; =
BORDER-LEFT: #000000 2px solid; MARGIN-RIGHT: 0px">
    <DIV style=3D"FONT: 10pt arial">----- Original Message ----- </DIV>
    <DIV=20
    style=3D"BACKGROUND: #e4e4e4; FONT: 10pt arial; font-color: =
black"><B>From:</B>=20
    <A title=3Dtpsoftware@users.sourceforge.net=20
    href=3D"mailto:tpsoftware@users.sourceforge.net">Timothy Parez</A> =
</DIV>
    <DIV style=3D"FONT: 10pt arial"><B>To:</B> <A =
title=3Dmono-list@ximian.com=20
    href=3D"mailto:mono-list@ximian.com">mono-list@ximian.com</A> </DIV>
    <DIV style=3D"FONT: 10pt arial"><B>Sent:</B> Wednesday, March 19, =
2003 11:08=20
    PM</DIV>
    <DIV style=3D"FONT: 10pt arial"><B>Subject:</B> [Mono-list]=20
    System.Net.Sockets.SocketException</DIV>
    <DIV><BR></DIV>
    <DIV><FONT face=3DArial size=3D2>Hi,</FONT></DIV>
    <DIV><FONT face=3DArial size=3D2></FONT>&nbsp;</DIV>
    <DIV><FONT face=3DArial size=3D2>I'm writing a set of class libs for =

    .NET/Mono,</FONT></DIV>
    <DIV><FONT face=3DArial size=3D2>except for the UTF7 Encoding in my =
other post,=20
    it should work fine.</FONT></DIV>
    <DIV><FONT face=3DArial size=3D2>And it does on .NET, but not on=20
    Mono.</FONT></DIV>
    <DIV><FONT face=3DArial size=3D2></FONT>&nbsp;</DIV>
    <DIV><FONT face=3DArial size=3D2>I don't know where to start, but =
I'll try to=20
    explain.</FONT></DIV>
    <DIV><FONT face=3DArial size=3D2></FONT>&nbsp;</DIV>
    <DIV><FONT face=3DArial size=3D2>First of all I have a Base Class =
which amongst=20
    other members has the following function</FONT></DIV>
    <DIV><FONT face=3DArial size=3D2></FONT>&nbsp;</DIV>
    <DIV><FONT face=3DArial size=3D2>&nbsp;private void=20
    ExecuteQuery()<BR>&nbsp;&nbsp;{<BR>&nbsp;&nbsp;&nbsp;UdpClient =
client =3D new=20
    UdpClient();<BR>&nbsp;&nbsp;&nbsp;//Connect to the server and send =
the query=20
    =
data<BR>&nbsp;&nbsp;&nbsp;try<BR>&nbsp;&nbsp;&nbsp;{<BR>&nbsp;&nbsp;&nbsp=
;&nbsp;client.Connect(ip,port);<BR>&nbsp;&nbsp;&nbsp;&nbsp;client.Send(da=
ta,data.Length);<BR>&nbsp;&nbsp;&nbsp;}<BR>&nbsp;&nbsp;&nbsp;catch<BR>&nb=
sp;&nbsp;&nbsp;{<BR>&nbsp;&nbsp;&nbsp;&nbsp;client.Close();<BR>&nbsp;&nbs=
p;&nbsp;&nbsp;throw=20
    new Exceptions.InvalidHostException("Unknown host: " +=20
    ip);<BR>&nbsp;&nbsp;&nbsp;}</FONT></DIV>
    <DIV>&nbsp;</DIV>
    <DIV><FONT face=3DArial size=3D2>&nbsp;&nbsp;&nbsp;//Listen for a =
response -=20
    This is the client side<BR>&nbsp;&nbsp;&nbsp;IPEndPoint =
serverIPEndPoint =3D=20
    new=20
    =
IPEndPoint(IPAddress.Any,0);<BR>&nbsp;&nbsp;&nbsp;<BR>&nbsp;&nbsp;&nbsp;/=
/Receive=20
    the=20
    =
response<BR>&nbsp;&nbsp;&nbsp;try<BR>&nbsp;&nbsp;&nbsp;{<BR>&nbsp;&nbsp;&=
nbsp;&nbsp;queryResponse=20
    =3D client.Receive(ref=20
    serverIPEndPoint);<BR>&nbsp;&nbsp;&nbsp;}<BR>&nbsp;&nbsp;&nbsp;catch =

    (Exception =
e)<BR>&nbsp;&nbsp;&nbsp;{<BR>&nbsp;&nbsp;&nbsp;&nbsp;throw new=20
    Exceptions.ConnectionRefusedException("The connection was refused by =
the=20
    remote host: " + ip + ":" + port.ToString() + "\n" +=20
    =
e.Message,e);<BR>&nbsp;&nbsp;&nbsp;}<BR>&nbsp;&nbsp;&nbsp;finally<BR>&nbs=
p;&nbsp;&nbsp;{<BR>&nbsp;&nbsp;&nbsp;&nbsp;client.Close();<BR>&nbsp;&nbsp=
;&nbsp;}<BR>&nbsp;&nbsp;}</FONT></DIV>
    <DIV><FONT face=3DArial size=3D2></FONT>&nbsp;</DIV>
    <DIV><FONT face=3DArial size=3D2>As you can see it sends a n array =
of bytes to=20
    the server and receives some in return.</FONT></DIV>
    <DIV><FONT face=3DArial size=3D2></FONT>&nbsp;</DIV>
    <DIV><FONT face=3DArial size=3D2>Then I have a derived class which =
has 2=20
    important functions:</FONT></DIV>
    <DIV><FONT face=3DArial size=3D2></FONT>&nbsp;</DIV>
    <DIV><FONT face=3DArial size=3D2>&nbsp;&nbsp;public string=20
    RequestStatus()<BR>&nbsp;&nbsp;{<BR>&nbsp;&nbsp;&nbsp;//Create the =
byte[]=20
    array to send<BR>&nbsp;&nbsp;&nbsp;byte[] query =3D=20
    =
{0xFF,0xFF,0xFF,0xFF,0x67,0x65,0x74,0x73,0x74,0x61,0x74,0x75,0x73,0xA};<B=
R>&nbsp;&nbsp;&nbsp;<BR>&nbsp;&nbsp;&nbsp;//Create=20
    a new separator<BR>&nbsp;&nbsp;&nbsp;char separator =3D=20
    Convert.ToChar(10);</FONT></DIV>
    <DIV>&nbsp;</DIV>
    <DIV><FONT face=3DArial size=3D2>&nbsp;&nbsp;&nbsp;//A statusRequest =
consists of=20
    both rules and players separated by =
char(10)<BR>&nbsp;&nbsp;&nbsp;string[]=20
    response =3D=20
    =
this.QueryToString(query).Split(separator);<BR>&nbsp;&nbsp;&nbsp;<BR>&nbs=
p;&nbsp;&nbsp;//Get=20
    the rules and players<BR>&nbsp;&nbsp;&nbsp;string rules =3D=20
    this.RulesToXml(response[0]);<BR>&nbsp;&nbsp;&nbsp;string players =
=3D=20
    =
this.PlayersToXml(response);<BR>&nbsp;&nbsp;<BR>&nbsp;&nbsp;&nbsp;return =

    =
this.CreateXmlBody("Quake3","statusRequest",string.Concat(rules,players))=
;<BR>&nbsp;&nbsp;}</FONT></DIV>
    <DIV><FONT face=3DArial size=3D2></FONT>&nbsp;</DIV>
    <DIV><FONT face=3DArial size=3D2>And</FONT></DIV>
    <DIV><FONT face=3DArial size=3D2></FONT>&nbsp;</DIV>
    <DIV><FONT face=3DArial size=3D2>&nbsp;&nbsp;public string=20
    RequestInfo()<BR>&nbsp;&nbsp;{<BR>&nbsp;&nbsp;&nbsp;//Create the =
byte[]=20
    array to send<BR>&nbsp;&nbsp;&nbsp;byte[] query =3D=20
    =
{0xFF,0xFF,0xFF,0xFF,0x67,0x65,0x74,0x69,0x6E,0x66,0x6F,0xA};<BR>&nbsp;&n=
bsp;&nbsp;<BR>&nbsp;&nbsp;&nbsp;//Query=20
    the server and get the response in a =
string<BR>&nbsp;&nbsp;&nbsp;string=20
    response =3D=20
    =
this.QueryToString(query);<BR>&nbsp;&nbsp;&nbsp;<BR>&nbsp;&nbsp;&nbsp;//C=
reate=20
    the default xml body and put the rules in =
it<BR>&nbsp;&nbsp;&nbsp;string=20
    returnValue =3D=20
    =
this.CreateXmlBody("Quake3","infoRequest",this.RulesToXml(response));</FO=
NT></DIV>
    <DIV>&nbsp;</DIV>
    <DIV><FONT face=3DArial size=3D2>&nbsp;&nbsp;&nbsp;//return the=20
    XML<BR>&nbsp;&nbsp;&nbsp;return =
returnValue;<BR>&nbsp;&nbsp;}</FONT></DIV>
    <DIV><FONT face=3DArial size=3D2></FONT>&nbsp;</DIV>
    <DIV><FONT face=3DArial size=3D2>As you can see there is almost no =
difference=20
    between them.</FONT></DIV>
    <DIV><FONT face=3DArial size=3D2>Now they both run fine with the =
.NET runtime,=20
    but with the mono runtime the .RequestStatus() fails.</FONT></DIV>
    <DIV><FONT face=3DArial size=3D2></FONT>&nbsp;</DIV>
    <DIV><FONT face=3DArial size=3D2>When does it fail well when the =
QueryToString=20
    function is called,</FONT></DIV>
    <DIV><FONT face=3DArial size=3D2>so if I run RequestInfo() the =
QueryToString=20
    function is called and it all works fine,</FONT></DIV>
    <DIV><FONT face=3DArial size=3D2>if I run RequestStatus() the =
QueryToString=20
    function is called and it goes wrong.</FONT></DIV>
    <DIV><FONT face=3DArial size=3D2>In my opinion the only difference =
so far is the=20
    array of bytes to be sent.</FONT></DIV>
    <DIV><FONT face=3DArial size=3D2></FONT>&nbsp;</DIV>
    <DIV><FONT face=3DArial size=3D2>Example:</FONT></DIV>
    <DIV><FONT face=3DArial size=3D2></FONT>&nbsp;</DIV>
    <DIV><FONT face=3DArial size=3D2>Let's say I use the following code =
for an=20
    application</FONT></DIV>
    <DIV><FONT face=3DArial size=3D2></FONT>&nbsp;</DIV>
    <DIV><FONT face=3DArial size=3D2>using System;<BR>using=20
    TPSoftware.Q3PlugsNet;<BR>using=20
    TPSoftware.Q3PlugsNet.Exceptions;</FONT></DIV>
    <DIV>&nbsp;</DIV>
    <DIV><FONT face=3DArial size=3D2>class =
MainClass<BR>{<BR>&nbsp;public static=20
    void Main(string[]=20
    =
args)<BR>&nbsp;{<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<BR>&nbsp;&nbsp;/=
/Create=20
    a new Q3Query<BR>&nbsp;<BR>&nbsp;//&nbsp;Q3Query quakeClient =3D new =

    Q3Query("195.130.132.153",27961);<BR>&nbsp;&nbsp;Q3Query quakeClient =
=3D new=20
    =
Q3Query("195.130.132.155",27961);<BR>&nbsp;&nbsp;<BR>&nbsp;&nbsp;try<BR>&=
nbsp;&nbsp;{<BR>&nbsp;&nbsp;&nbsp;string=20
    info =3D=20
    =
quakeClient.RequestStatus();<BR>&nbsp;&nbsp;&nbsp;Console.WriteLine(info)=
;<BR>&nbsp;&nbsp;}<BR>&nbsp;&nbsp;catch=20
    (Exception=20
    =
e)<BR>&nbsp;&nbsp;{<BR>&nbsp;&nbsp;&nbsp;Console.WriteLine("ERROR:");<BR>=
&nbsp;&nbsp;&nbsp;Console.WriteLine("\n"=20
    + =
e.ToString());&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;=20
    </FONT></DIV>
    <DIV><FONT face=3DArial=20
    =
size=3D2>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbs=
p;&nbsp;<BR>&nbsp;&nbsp;}<BR>&nbsp;&nbsp;finally<BR>&nbsp;&nbsp;{<BR>&nbs=
p;&nbsp;Console.ReadLine();<BR>&nbsp;&nbsp;}<BR>&nbsp;}<BR>}<BR></FONT></=
DIV>
    <DIV><FONT face=3DArial size=3D2>Well then I get the following =
result with .NET=20
    runtime</FONT></DIV>
    <DIV><FONT face=3DArial size=3D2></FONT>&nbsp;</DIV>
    <DIV><FONT face=3DArial size=3D2>&lt;?xml version=3D"1.0" =
encoding=3D"utf-7"=20
    standalone=3D"yes"?&gt;&lt;Q3Plugs.NET&gt;&lt;Query =
type=3D<BR>"statusRequest"=20
    protocol=3D"Quake3"&gt;&lt;Server ipadress=3D"195.130.132.155" =
port=3D"27961<BR>"=20
    /&gt;&lt;Rules count=3D"28"&gt;&lt;rule=20
    name=3D"capturelimit"&gt;&lt;![CDATA[8]]&gt;&lt;/rule&gt;&lt;rule=20
    =
name=3D"<BR>sv_floodProtect"&gt;&lt;![CDATA[0]]&gt;&lt;/rule&gt;&lt;rule =

    name=3D"sv_maxPing"&gt;&lt;![CDATA[0]]&gt;&lt;/rule<BR>&gt;&lt;rule=20
    name=3D"sv_minPing"&gt;&lt;![CDATA[0]]&gt;&lt;/rule&gt;&lt;rule=20
    =
name=3D"sv_maxRate"&gt;&lt;![CDATA[15<BR>000]]&gt;&lt;/rule&gt;&lt;rule=20
    name=3D"sv_punkbuster"&gt;&lt;![CDATA[0]]&gt;&lt;/rule&gt;&lt;rule=20
    =
name=3D"sv_maxcl<BR>ients"&gt;&lt;![CDATA[14]]&gt;&lt;/rule&gt;&lt;rule=20
    name=3D"sv_hostname"&gt;&lt;![CDATA[Telenet Q3A OSP=20
    CA<BR>&nbsp;Server]]&gt;&lt;/rule&gt;&lt;rule=20
    name=3D"timelimit"&gt;&lt;![CDATA[0]]&gt;&lt;/rule&gt;&lt;rule=20
    name=3D"fraglimi<BR>t"&gt;&lt;![CDATA[25]]&gt;&lt;/rule&gt;&lt;rule=20
    name=3D"dmflags"&gt;&lt;![CDATA[8]]&gt;&lt;/rule&gt;&lt;rule=20
    name=3D"ver<BR>sion"&gt;&lt;![CDATA[Q3 1.32 linux-i386 Oct&nbsp; 7=20
    2002]]&gt;&lt;/rule&gt;&lt;rule=20
    name=3D"g_gametype"&gt;&lt;<BR>![CDATA[5]]&gt;&lt;/rule&gt;&lt;rule=20
    name=3D"protocol"&gt;&lt;![CDATA[68]]&gt;&lt;/rule&gt;&lt;rule=20
    name=3D"mapnam<BR>e"&gt;&lt;![CDATA[q3dm6]]&gt;&lt;/rule&gt;&lt;rule =

    =
name=3D"sv_privateClients"&gt;&lt;![CDATA[2]]&gt;&lt;/rule&gt;&lt;r<BR>ul=
e=20
    =
name=3D"sv_allowDownload"&gt;&lt;![CDATA[1]]&gt;&lt;/rule&gt;&lt;rule=20
    =
name=3D"server_promode"&gt;&lt;![C<BR>DATA[0]]&gt;&lt;/rule&gt;&lt;rule=20
    name=3D"server_cq3"&gt;&lt;![CDATA[0]]&gt;&lt;/rule&gt;&lt;rule=20
    name=3D"g_needpa<BR>ss"&gt;&lt;![CDATA[0]]&gt;&lt;/rule&gt;&lt;rule=20
    name=3D"server_ospauth"&gt;&lt;![CDATA[2]]&gt;&lt;/rule&gt;&lt;rule=20
    na<BR>me=3D"gamename"&gt;&lt;![CDATA[osp]]&gt;&lt;/rule&gt;&lt;rule=20
    name=3D"gameversion"&gt;&lt;![CDATA[OSP =
v1.03]<BR>]&gt;&lt;/rule&gt;&lt;rule=20
    name=3D"Players_Red"&gt;&lt;![CDATA[2 4 6 8 10 =
]]&gt;&lt;/rule&gt;&lt;rule=20
    name=3D"Play<BR>ers_Blue"&gt;&lt;![CDATA[1 3 5 7 9 =
]]&gt;&lt;/rule&gt;&lt;rule=20
    name=3D"Score_Red"&gt;&lt;![CDATA[15]]&gt;&lt;/ru<BR>le&gt;&lt;rule=20
    name=3D"Score_Blue"&gt;&lt;![CDATA[17]]&gt;&lt;/rule&gt;&lt;rule=20
    name=3D"Score_Time"&gt;&lt;![CDATA<BR>[Round=20
    33/49]]&gt;&lt;/rule&gt;&lt;/Rules&gt;&lt;Players =
count=3D"10"&gt;&lt;Player=20
    score=3D"20"=20
    =
ping=3D"15"&gt;&lt;<BR>![CDATA["^5DA^4.^5Ch^7a^5o^7s"]]&gt;&lt;/Player&gt=
;&lt;Player=20
    score=3D"12"=20
    =
ping=3D"24"&gt;&lt;![CDATA[<BR>"UnnamedPlaye^1r"]]&gt;&lt;/Player&gt;&lt;=
Player=20
    score=3D"48"=20
    =
ping=3D"38"&gt;&lt;![CDATA["^b^0*^n^7mnl<BR>^b^0*"]]&gt;&lt;/Player&gt;&l=
t;Player=20
    score=3D"38"=20
    =
ping=3D"38"&gt;&lt;![CDATA["^xffffff^9eHk^b^4*^n^0T<BR>^9N^0T"]]&gt;&lt;/=
Player&gt;&lt;Player=20
    score=3D"80"=20
    =
ping=3D"25"&gt;&lt;![CDATA["^5B^7osje^5R"]]&gt;&lt;/Play<BR>er&gt;&lt;Pla=
yer=20
    score=3D"85"=20
    =
ping=3D"24"&gt;&lt;![CDATA["^x00FF00^2911^xFFFFFF^0&gt;&gt;^7SaTo"]]&gt;&=
lt;/P<BR>layer&gt;&lt;Player=20
    score=3D"18"=20
    ping=3D"52"&gt;&lt;![CDATA["^4jerome"]]&gt;&lt;/Player&gt;&lt;Player =

    score=3D<BR>"96"=20
    =
ping=3D"41"&gt;&lt;![CDATA["^x3366FF^7e^0C^7'.E^0mo^7Z"]]&gt;&lt;/Player&=
gt;&lt;Player=20
    score=3D"1<BR>1"=20
    ping=3D"16"&gt;&lt;![CDATA["crypto"]]&gt;&lt;/Player&gt;&lt;Player =
score=3D"73"=20
    =
ping=3D"40"&gt;&lt;![CDATA[<BR>"^0fearl^33^0ss"]]&gt;&lt;/Player&gt;&lt;/=
Players&gt;&lt;/Query&gt;&lt;/Q3Plugs.NET&gt;<BR></FONT></DIV>
    <DIV><FONT face=3DArial size=3D2>But I get the following with the =
mono=20
    runtime:</FONT></DIV>
    <DIV><FONT face=3DArial size=3D2></FONT>&nbsp;</DIV>
    <DIV><FONT face=3DArial size=3D2>Unhandled Exception:=20
    TPSoftware.Q3PlugsNet.Exceptions.ConnectionRefusedException<BR>: The =

    connection was refused by the remote host: =
195.130.132.155:27961<BR>Some=20
    sort of w32 error occurred ---&gt; =
System.Net.Sockets.SocketException: Some=20
    so<BR>rt of w32 error occurred<BR>in (unmanaged) 06=20
    System.Net.Sockets.Socket:RecvFrom_internal=20
    =
(intptr,byte[],int<BR>,int,System.Net.Sockets.SocketFlags,System.Net.Sock=
etAddress&amp;)<BR>in=20
    &lt;0x00004&gt; 06 System.Net.Sockets.Socket:RecvFrom_internal=20
    =
(intptr,byte[],int,i<BR>nt,System.Net.Sockets.SocketFlags,System.Net.Sock=
etAddress&amp;)<BR>in=20
    &lt;0x00155&gt; 00 System.Net.Sockets.Socket:ReceiveFrom=20
    =
(byte[],int,int,System.Net<BR>.Sockets.SocketFlags,System.Net.EndPoint&am=
p;)<BR>in=20
    &lt;0x00180&gt; 00 System.Net.Sockets.Socket:ReceiveFrom=20
    =
(byte[],int,int,System.Net<BR>.Sockets.SocketFlags,System.Net.EndPoint&am=
p;)<BR>in=20
    &lt;0x0002a&gt; 00 System.Net.Sockets.Socket:ReceiveFrom=20
    (byte[],System.Net.EndPoin<BR>t&amp;)<BR>in &lt;0x000af&gt; 00=20
    System.Net.Sockets.UdpClient:Receive =
(System.Net.IPEndPoint&amp;)<BR>in=20
    &lt;0x0016b&gt; 00 TPSoftware.Q3PlugsNet.QueryBase:ExecuteQuery =
()<BR>---=20
    End of inner exception stack trace ---</FONT></DIV>
    <DIV>&nbsp;</DIV>
    <DIV><FONT face=3DArial size=3D2>in &lt;0x002b4&gt; 00=20
    TPSoftware.Q3PlugsNet.QueryBase:ExecuteQuery ()<BR>in =
&lt;0x0005b&gt; 01=20
    System.MulticastDelegate:invoke_void ()<BR></FONT></DIV>
    <DIV><FONT face=3DArial size=3D2></FONT>&nbsp;</DIV>
    <DIV><FONT face=3DArial size=3D2>However if I change the above code=20
    to:</FONT></DIV>
    <DIV><FONT face=3DArial size=3D2></FONT>&nbsp;</DIV>
    <DIV><FONT face=3DArial size=3D2>using System;<BR>using=20
    TPSoftware.Q3PlugsNet;<BR>using=20
    TPSoftware.Q3PlugsNet.Exceptions;</FONT></DIV>
    <DIV>&nbsp;</DIV>
    <DIV><FONT face=3DArial size=3D2>class =
MainClass<BR>{<BR>&nbsp;public static=20
    void Main(string[]=20
    =
args)<BR>&nbsp;{<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<BR>&nbsp;&nbsp;/=
/Create=20
    a new Q3Query<BR>&nbsp;<BR>&nbsp;//&nbsp;Q3Query quakeClient =3D new =

    Q3Query("195.130.132.153",27961);<BR>&nbsp;&nbsp;Q3Query quakeClient =
=3D new=20
    =
Q3Query("195.130.132.155",27961);<BR>&nbsp;&nbsp;<BR>&nbsp;&nbsp;try<BR>&=
nbsp;&nbsp;{<BR>&nbsp;&nbsp;&nbsp;string=20
    info =3D quakeClient.RequestInfo(); // RequestInfo instead of =
RequestStatus=20
    =
!!!!!!!!<BR>&nbsp;&nbsp;&nbsp;Console.WriteLine(info);<BR>&nbsp;&nbsp;}<B=
R>&nbsp;&nbsp;catch=20
    (Exception=20
    =
e)<BR>&nbsp;&nbsp;{<BR>&nbsp;&nbsp;&nbsp;Console.WriteLine("ERROR:");<BR>=
&nbsp;&nbsp;&nbsp;Console.WriteLine("\n"=20
    + =
e.ToString());&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;=20
    </FONT></DIV>
    <DIV>&nbsp;</DIV>
    <DIV><FONT face=3DArial=20
    =
size=3D2>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbs=
p;=20
    =
<BR>&nbsp;&nbsp;}<BR>&nbsp;&nbsp;finally<BR>&nbsp;&nbsp;{<BR>&nbsp;&nbsp;=
Console.ReadLine();<BR>&nbsp;&nbsp;}<BR>&nbsp;}<BR>}</DIV></FONT>
    <DIV><FONT face=3DArial size=3D2>&nbsp;</DIV></FONT>
    <DIV><FONT face=3DArial size=3D2>I get the following output with=20
    .NET</FONT></DIV>
    <DIV><FONT face=3DArial size=3D2></FONT>&nbsp;</DIV>
    <DIV><FONT face=3DArial size=3D2>&lt;?xml version=3D"1.0" =
encoding=3D"utf-7"=20
    standalone=3D"yes"?&gt;&lt;Q3Plugs.NET&gt;&lt;Query =
type=3D<BR>"infoRequest"=20
    protocol=3D"Quake3"&gt;&lt;Server ipadress=3D"195.130.132.155"=20
    port=3D"27961"<BR>/&gt;&lt;Rules count=3D"9"&gt;&lt;rule=20
    name=3D"game"&gt;&lt;![CDATA[osp]]&gt;&lt;/rule&gt;&lt;rule=20
    name=3D"punkbuste<BR>r"&gt;&lt;![CDATA[0]]&gt;&lt;/rule&gt;&lt;rule=20
    name=3D"pure"&gt;&lt;![CDATA[1]]&gt;&lt;/rule&gt;&lt;rule=20
    name=3D"gametyp<BR>e"&gt;&lt;![CDATA[5]]&gt;&lt;/rule&gt;&lt;rule=20
    name=3D"sv_maxclients"&gt;&lt;![CDATA[12]]&gt;&lt;/rule&gt;&lt;rule=20
    nam<BR>e=3D"clients"&gt;&lt;![CDATA[2]]&gt;&lt;/rule&gt;&lt;rule=20
    name=3D"mapname"&gt;&lt;![CDATA[q3dm6]]&gt;&lt;/rule&gt;&lt;ru<BR>le =

    name=3D"hostname"&gt;&lt;![CDATA[Telenet Q3A OSP CA=20
    Server]]&gt;&lt;/rule&gt;&lt;rule=20
    =
name=3D"proto<BR>col"&gt;&lt;![CDATA[68]]&gt;&lt;/rule&gt;&lt;/Rules&gt;&=
lt;/Query&gt;&lt;/Q3Plugs.NET&gt;<BR></FONT></DIV>
    <DIV><FONT face=3DArial size=3D2>And the following output with mono =
(don't mind=20
    the encoding, that's another bug)</FONT></DIV><FONT face=3DArial =
size=3D2>
    <DIV><BR>???xml version???1.0?? encoding???utf-7?? =
standalone???yes????=20
    ??Q3Plugs.NET? ??<BR>Query type???infoRequest?? protocol???Quake3??? =

    ??Server ipadress???195.130.132.<BR>155?? port???27961?? /? ???Rules =

    count????+BDJAAARO?????=20
    name?????+BDJAAARO???+E<BR>JwMQFQE+AFs-osp???+-???/rule???+QAA-rule=20
    name???????+BDJAAARO???+EJwMQFQE+AFs-0?<BR>??+-???/rule???+QAA-rule=20
    name?????+BDJAAARO???+EJwMQFQE+AFs-1???+-???/rule???+QA<BR>A-rule=20
    name??????+BDJAAARO???+EJwMQFQE+AFs-5???+-???/rule???+QAA-rule=20
    =
name????+B<BR>G8AAA-maxclients???+AAAETEEl???+-AFs-12???+-???/rule???+QAA=
-rule=20
    name??????+BDJA<BR>AARO???+EJwMQFQE+AFs-2???+-???/rule???+QAA-rule=20
    =
name??????+BDJAAARO???+EJwMQFQE+<BR>AFs-q3dm6???+-???/rule???+QAA-rule=20
    name??????+BDJAAARO???+EJwMQFQE+AFs-Telenet Q<BR>3A OSP CA=20
    Server???+-???/rule???+QAA-rule=20
    =
name??????+BDJAAARO???+EJwMQFQE+AFs-68<BR>???+-???/rule???+QAA-/Rules????=
?/Query?=20
    ??/Q3Plugs.NET?</DIV>
    <DIV>&nbsp;</DIV>
    <DIV>So this works fine (more or less) and doesn't throw any =
errors.</DIV>
    <DIV>&nbsp;</DIV>
    <DIV>So my question: Why does RequestStatus cause an error while =
RequestInfo=20
    does not.</DIV>
    <DIV>&nbsp;</DIV>
    <DIV>If you want to view the full sources of the library please =
visit:</DIV>
    <DIV><A=20
    =
href=3D"http://cvs.sourceforge.net/cgi-bin/viewcvs.cgi/q3plugs/Q3Plugs.NE=
T/">http://cvs.sourceforge.net/cgi-bin/viewcvs.cgi/q3plugs/Q3Plugs.NET/</=
A></DIV>
    <DIV>&nbsp;</DIV>
    <DIV>Thnx,</DIV>
    <DIV>Timothy P.<BR></DIV></FONT>
    <DIV><FONT face=3DArial size=3D2></FONT>&nbsp;</DIV>
    <DIV>&nbsp;</DIV><FONT face=3DArial size=3D2>
    <DIV><BR>---<BR>Outgoing mail is certified Virus Free.<BR>Checked by =
AVG=20
    anti-virus system (<A=20
    =
href=3D"http://www.grisoft.com">http://www.grisoft.com</A>).<BR>Version: =

    6.0.463 / Virus Database: 262 - Release Date: 17/03/2003</DIV>
    <DIV>&nbsp;</DIV>
    <DIV><BR>---<BR>Outgoing mail is certified Virus Free.<BR>Checked by =
AVG=20
    anti-virus system (<A=20
    =
href=3D"http://www.grisoft.com">http://www.grisoft.com</A>).<BR>Version: =

    6.0.463 / Virus Database: 262 - Release Date:=20
  18/03/2003</FONT></DIV></BLOCKQUOTE></BLOCKQUOTE></BODY></HTML>

------=_NextPart_000_0014_01C2EE76.58548180--