[Mono-list] UdpClient question

Daniel Morgan danielmorgan@verizon.net
Fri, 28 May 2004 21:48:24 -0400


Have you tried the same code with C#?

This would help determine if it's a problem with mbas or not.

The Mono Basic compiler is not as stable as the Mono C# compiler.  Mbas
is getting there though.

-----Original Message-----
From: mono-list-admin@lists.ximian.com
[mailto:mono-list-admin@lists.ximian.com] On Behalf Of Stephan Eberle
Sent: Friday, May 28, 2004 3:51 PM
To: mono-list@lists.ximian.com
Subject: [Mono-list] UdpClient question


Good evening :)

I have this problem driving me crazy...
I'm about to write a server application with VS.NET on windows. Target 
OS is Linux (debian) with mono 1.0 (.91)...

My code works well with Windows using Microsoft .NET Framework 1.1, 
using mono, nothing happens. And before I install a packet sniffer to 
see if a UDP-datagram is sent I thought it might be better to just ask 
you if there's anything wrong (maybe my code is broken is some way).

I'm using this code:

------------------------------------------------------------------------
------
Dim Sv As New clsRCon("213.202.216.25", 12005)
Sv.udpSend("rcon PWD say ""Text to appear in ingame console...""")
------------------------------------------------------------------------
------


This is my simple UDP Sender class:

------------------------------------------------------------------------
------
' Klasse, um RCON-Befehle an MoH:AA zu senden!
Public Class clsRCon

    Public Sck As UdpClient
    Public rep As Net.EndPoint

    Public Sub New(ByVal HostAddr As String, ByVal Port As Integer)

        rep = New IPEndPoint(IPAddress.Parse(HostAddr), Port)
        Sck = New UdpClient(HostAddr, Port)

    End Sub

    Public Sub udpSend(ByVal CommandText As String)

        Dim TMP As String = New String(Chr(255), 4) & Chr(2) & 
CommandText & Chr(0)
        Dim Buf() As Byte = System.Text.Encoding.Default.GetBytes(TMP)

        Try
            Sck.Send(Buf, Buf.Length)
        Catch e As Exception
            Console.WriteLine(e.ToString())
        End Try

    End Sub

End Class
------------------------------------------------------------------------
------


Any idea?

Thank's in advance,
Stevie


_______________________________________________
Mono-list maillist  -  Mono-list@lists.ximian.com
http://lists.ximian.com/mailman/listinfo/mono-list