aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/ClientStack/UDPServer.cs
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--OpenSim/Region/ClientStack/UDPServer.cs35
1 files changed, 15 insertions, 20 deletions
diff --git a/OpenSim/Region/ClientStack/UDPServer.cs b/OpenSim/Region/ClientStack/UDPServer.cs
index 10a51e5..395037f 100644
--- a/OpenSim/Region/ClientStack/UDPServer.cs
+++ b/OpenSim/Region/ClientStack/UDPServer.cs
@@ -364,33 +364,28 @@ namespace OpenSim.Region.ClientStack
364 public void ServerListener() 364 public void ServerListener()
365 { 365 {
366 uint newPort = listenPort; 366 uint newPort = listenPort;
367 for (uint i = 0; i < 20; i++) 367 m_log.Info("[SERVER]: Opening UDP socket on " + listenIP.ToString() + " " + newPort + ".");// Allow alternate ports: " + Allow_Alternate_Port.ToString());
368 try
368 { 369 {
369 newPort = listenPort + i; 370 ServerIncoming = new IPEndPoint(listenIP, (int)newPort);
370 m_log.Info("[SERVER]: Opening UDP socket on " + listenIP.ToString() + " " + newPort + ".");// Allow alternate ports: " + Allow_Alternate_Port.ToString()); 371 Server = new Socket(AddressFamily.InterNetwork, SocketType.Dgram, ProtocolType.Udp);
371 try 372 Server.Bind(ServerIncoming);
372 { 373 listenPort = newPort;
373 ServerIncoming = new IPEndPoint(listenIP, (int) newPort); 374 }
374 Server = new Socket(AddressFamily.InterNetwork, SocketType.Dgram, ProtocolType.Udp); 375 catch (Exception ex)
375 Server.Bind(ServerIncoming); 376 {
376 listenPort = newPort; 377 // We are not looking for alternate ports?
377 break; 378 //if (!Allow_Alternate_Port)
378 } 379 throw (ex);
379 catch (Exception ex)
380 {
381 // We are not looking for alternate ports?
382 //if (!Allow_Alternate_Port)
383 throw (ex);
384 380
385 // We are looking for alternate ports! 381 // We are looking for alternate ports!
386 //m_log.Info("[SERVER]: UDP socket on " + listenIP.ToString() + " " + listenPort.ToString() + " is not available, trying next."); 382 //m_log.Info("[SERVER]: UDP socket on " + listenIP.ToString() + " " + listenPort.ToString() + " is not available, trying next.");
387 }
388 } 383 }
389 384
390 m_log.Info("[SERVER]: UDP socket bound, getting ready to listen"); 385 m_log.Info("[SERVER]: UDP socket bound, getting ready to listen");
391 386
392 ipeSender = new IPEndPoint(listenIP, 0); 387 ipeSender = new IPEndPoint(listenIP, 0);
393 epSender = (EndPoint) ipeSender; 388 epSender = (EndPoint)ipeSender;
394 ReceivedData = new AsyncCallback(OnReceivedData); 389 ReceivedData = new AsyncCallback(OnReceivedData);
395 Server.BeginReceiveFrom(RecvBuffer, 0, RecvBuffer.Length, SocketFlags.None, ref epSender, ReceivedData, null); 390 Server.BeginReceiveFrom(RecvBuffer, 0, RecvBuffer.Length, SocketFlags.None, ref epSender, ReceivedData, null);
396 391