[Mono-dev] mono-services, possible bug
Johannes Rauber
j.rauber at konzeptpark.de
Fri Sep 23 06:52:41 EDT 2005
Hi,
i wrote a little udp-server, which recieves udp packets and logs
them into a file.
I implemented this server into a .net Service Project and it runs
fine after installing on any windows machine i tested.
When i start it on Suse 9.3 with mono 1.1.8.1 using mono-services it
starts but never recieves anything.
The code which is running in an backgrund thread is appended on to the
mail,
i debugged the code an the problem is that : soUdp.ReceiveFrom()
is never left, when i start the service on my console, without
mono-services
it runs fine.
Any solution, explenation
private void StartReceive()
{
EndPoint remoteEP = new IPEndPoint(IPAddress.Any,0);
Socket soUdp = new Socket(AddressFamily.InterNetwork,
SocketType.Dgram, ProtocolType.Udp);
IPEndPoint localIpEndPoint = new IPEndPoint(IPAddress.Any,
UdpPort);
soUdp.Bind(localIpEndPoint);
while (true)
{
Byte[] received = new Byte[1024];
Byte[] message;
int bytesReceived;
try
{
bytesReceived = soUdp.ReceiveFrom(received, ref
remoteEP);
// It never comes that far
if (bytesReceived > 0)
{
message = new Byte[bytesReceived];
Array.Copy(received, 0, message,
0,bytesReceived);
Command(message); //Event
String transmitted = "";
foreach (byte bt in message)
{
transmitted = transmitted +
(char)bt;
}
log(transmitted);
String returningString = "OK";
Byte[] returningByte =
System.Text.Encoding.ASCII.GetBytes(returningString.ToCharArray());
soUdp.SendTo(returningByte, remoteEP);
}
}
catch (SocketException se)
{
log(se.Message);
}
}
}
____________
Virus checked by G DATA AntiVirusKit
Version: AVK 16.630 from 23.09.2005
More information about the Mono-devel-list
mailing list