[Mono-list] UdpClient question
Stephan Eberle
hawke@deltacity.org
Fri, 28 May 2004 21:51:29 +0200
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