|
||
|
|||||||
| Other Cant find a category above, use this one! Core mods not listed above go here! |
![]() |
|
|
Thread Tools | Display Modes |
|
|
#1 (permalink) |
|
Forum Novice
|
This one has also been in the Bugtracker for quite a while now, and i'll post a fix for it here:
The problem is that RunUO does not print an error message if it fails to bind the socket. So it may be that you fail to connect to you server, because another application is using the port, but you are not informed about the socket error. So here is a possible fix for that - there are more possibilities to do that, but i thought this is the most simple one Since Listener.Bind(IPAddress, int) returns a Socket object i just check if this returned object is null, which means, that an exception occured in this method. I do this check directly after Listener.Bind(IPAddress, int) is called in Listener..ctor(int) Code:
public Listener( int port )
{
m_ThisPort = port;
m_Disposed = false;
m_Accepted = new Queue();
m_OnAccept = new AsyncCallback( OnAccept );
m_Listener = Bind( IPAddress.Any, port );
if (m_Listener == null) {
Console.WriteLine("RunUO failed to bind the Socket. You may not be able to connect to the server");
} else {
try {
IPHostEntry iphe = Dns.Resolve( Dns.GetHostName() );
ArrayList list = new ArrayList();
list.Add( IPAddress.Loopback );
Console.WriteLine( "Address: {0}:{1}", IPAddress.Loopback, port );
IPAddress[] ips = iphe.AddressList;
for ( int i = 0; i < ips.Length; ++i ) {
if ( !list.Contains( ips[i] ) ) {
list.Add( ips[i] );
Console.WriteLine( "Address: {0}:{1}", ips[i], port );
}
}
}
catch {
}
}
}
Considering that Listener.cs provides some of the really, really basic functionality of RunUO the exception handling is way too weak in my opinion. |
|
|
|
|
|
#3 (permalink) |
|
Forum Expert
Join Date: Sep 2004
Age: 37
Posts: 1,006
|
actually, I disagree. Another app is a possibility, but there's other things that bind ports. bad drivers, power failures, other wierdness. I've seen a problem where every time the server conputer was restarted, the damn NIC wouldn't restart.
Better to get an exception than be in the dark about it. |
|
|
|
|
|
#4 (permalink) |
|
RunUO Developer/Demise Person
Join Date: Mar 2003
Location: California
Age: 20
Posts: 1,700
|
Actually, something to deal with it not binding to the socket was already put in place for the next version of RunUO atleast a month ago
![]()
__________________
Andre Sayre, Core Developer The RunUO Software Team The day we are born is the day Death inches ever closer... E-mail: ASayre ( AT ) RunUO ( Dot ) c o m I'm as graceful as a gazelle galloping over glistening green grass with it's head on fire. |
|
|
|
![]() |
| Bookmarks |
| Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
| Thread Tools | |
| Display Modes | |
|
|