RunUO Community

This is a sample guest message. Register a free account today to become a member! Once signed in, you'll be able to participate on this site by adding your own topics and posts, as well as connect with other members through your own private inbox!

lan and internet use on the same server

L

laphanso

Guest
lan and internet use on the same server

I have read through many things and i cant find anything on how to run lan game and internet game on the same server. I have a lot of friends and we want to get this game up and running so that my local friends can play on our network along with my other friends who have to play over the internet. But i havent found anything on this particular issue. The only thing i keep getting is lan can play on lan and internet on internet, not both on one. If you or anyone could help it would be great. Thanks.
 

DragoZack

Wanderer
Both work.
The one who will connect to shard will use 192.168.0.2 for exemple and the others will use your IP from internet, or your dns domain
Just fill the serverlist.cs with your internet ip.
 
L

laphanso

Guest
see when i do that i have to change it to my router's ip address. When i do that internet uses can log on but lan uses cant log on. im guessing because the lan users have to connect useing my computers ip, where as internet uses have to use my router's ip. Unless there is a way that im missing i have tried entering my intenet ip and my router's ip. Both work but not together. so i am lost with what to do. If you know how to fix this or im just totally off could you please give me an example.
 
L

laphanso

Guest
or maybe im not makeing myself clear enough. lol :D I want my lan users and internet uses to be able to play together on the same map. Instead all i get is lan players play on there own map and internet users play on there own map. I want to be able to put them both on the same map so that they can play together. If there is something im missing please help me out thanks.
 
L

laphanso

Guest
is anyone checking into this issue? I looked into other forums and i ran accross this as someone's serverlist.cs file. Here are the contents:
// ServerList.cs
using System;
using System.Collections;
using System.Net;
using Server;
using Server.Network;

namespace Server.Misc
{
public class ServerList
{
public static string ServerName = "RunUO Test Center";
public static int ServerPort = 2593;

public static bool ServerUsingRouter = false ;
public static bool ServerRouterIPAutoUpdate = false ;

public static string RouterAddress = "__PUT_YOUR_ROUTER_IP_OR_ADDRESS_HERE_";
public static TimeSpan RouterIPAutoUpdateRate = TimeSpan.FromMinutes( 5.0 ) ;


private static IPAddress[] RouterIP ;

private static ArrayList LANIPs = null ;
private static ArrayList NetIPs = null ;

public static void Initialize()
{
Listener.Port = ServerPort;
SetIPList();
UpdateRouterIP();

EventSink.ServerList += new ServerListEventHandler( EventSink_ServerList );
}

#region IPMatch methods and related.

public static bool IPMatch( IPAddress ComparerIP, IPAddress IPMask, IPAddress ComparedIP )
{
return IPMatch( ComparerIP.Address, IPMask.Address, ComparedIP.Address ) ;
}

public static bool IPMatch( IPAddress ComparerIP, long IPMask, IPAddress ComparedIP )
{
return IPMatch( ComparerIP.Address, IPMask, ComparedIP.Address ) ;
}

public static bool IPMatch( long ComparerIP, long IPMask, long ComparedIP )
{
return ( ( ComparerIP & IPMask ) == ( ComparedIP & IPMask ) ) ;
}

public static bool IPMatch( IPAddress ComparerIP, int BitMask, IPAddress ComparedIP )
{
return IPMatch( ComparerIP.Address, BitMask, ComparedIP.Address ) ;
}

public static bool IPMatch( long ComparerIP, int BitMask, long ComparedIP )
{
return IPMatch( ComparerIP, (long) ( ( 1 << BitMask ) - 1 ) << ( 32 - BitMask ), ComparedIP ) ;
}

#endregion

private static bool IsLANAddress( IPAddress address )
{
if( IPMatch( 10 << 24, 8, address.Address) || // Local: 10.0.0.0\8
IPMatch( 172 << 24 + 16 << 16, 12, address.Address ) || // Local: 172.16.0.0\12
IPMatch( 192 << 24 + 168 << 16, 16, address.Address ) ) // Local: 192.168.0.0\16
{
return true ;
}

return false ;
}

public static void SetIPList( )
{
IPHostEntry thisHost = Dns.Resolve( Dns.GetHostName() );
IPAddress[] addressList = thisHost.AddressList;

LANIPs = new ArrayList() ;
NetIPs = new ArrayList() ;

foreach( IPAddress address in addressList )
{
if ( ! IPAddress.IsLoopback( address ) )
{
if ( IsLANAddress( address ) )
LANIPs.Add( address ) ;
else
{
if ( ! IPMatch( 198 << 24 + 18 << 16, 15, address.Address ) && // 198.18.0.0\15: Benchmark IPs
! IPMatch( 192 << 24 + 2 << 8, 24, address.Address ) && // 192.0.2.0\24: "TEST-NET" for Documentation and exemple code
! IPMatch( 169 << 24 + 254 << 16, 16, address.Address ) ) // 169.254.0.0\16: Link local (allocated for communication between hosts on a single link)
{
NetIPs.Add( address ) ;
}
}
}
}

if( LANIPs.Count == 0 )
LANIPs = null ;

if( NetIPs.Count == 0 )
NetIPs = null ;
}

public static void UpdateRouterIP( )
{
IPHostEntry host = null;
try
{
host = Dns.Resolve( RouterAddress ) ;
}
catch {}
finally
{
if ( host != null )
RouterIP = host.AddressList ;
else
{
if ( ServerUsingRouter )
Console.WriteLine( "ServerList: Invalid router address. Router support deactivated." ) ;
ServerUsingRouter = false ;
ServerRouterIPAutoUpdate = false ;
}
}
}

public class ServerUpdateTimer : Timer
{

public ServerUpdateTimer() : base( RouterIPAutoUpdateRate, RouterIPAutoUpdateRate )
{
Priority = TimerPriority.OneMinute;
if ( ServerUsingRouter && ServerRouterIPAutoUpdate )
this.Start();
}

protected override void OnTick()
{
if ( ! ServerRouterIPAutoUpdate )
this.Stop() ;
else
UpdateRouterIP() ;
}
}

public static void EventSink_ServerList( ServerListEventArgs e )
{
bool OneAddressAdded = false ; // True when at least one address as been added.
IPAddress RemoteIP = ((IPEndPoint)e.State.Socket.RemoteEndPoint).Address ;

// Check for Loopback address.
if( IPAddress.IsLoopback( RemoteIP ) )
{
e.AddServer( "Loopback " + ServerName, new IPEndPoint( IPAddress.Loopback, ServerPort ) );
OneAddressAdded = true ;
}

// Check for LAN if connected to one.
if( LANIPs != null && LANIPs.Count > 0 && IsLANAddress( RemoteIP ) )
{
for( int i = 0; i < LANIPs.Count; i ++ )
{
e.AddServer( String.Format( "LAN{0} ", ( i == 0 ) ? "" : (i + 1).ToString() ) + ServerName, new IPEndPoint( (IPAddress)LANIPs, ServerPort ) ) ;
OneAddressAdded = true ;
}
}

if( ! OneAddressAdded && RouterIP != null )
{

OneAddressAdded = true ;
}
else
{
if( NetIPs != null && NetIPs.Count > 0 )
{
for( int i = 0; i < NetIPs.Count; i ++ )
{
e.AddServer( String.Format( "{0}{1}", ServerName, ( i == 0 ) ? "" : (i + 1).ToString() ), new IPEndPoint( (IPAddress)NetIPs, ServerPort ) ) ;
OneAddressAdded = true ;
}
}
}

if( ! OneAddressAdded )
e.Rejected = true ;
}
}
}


Is this the proper way to set up the serverlist.cs file so that internet and lan games can play together at the same time on the same map?
 

thevermon

Sorceror
I am having this exact same problem with beta22 and I tried that serverlist you posted and didn't work.... any one else have any ideas?
 

David

Moderate
You are saying they both can log in but they are on different maps? How odd. have you tried changing maps with the [Props command or a moongate?
 

thevermon

Sorceror
in my case if I put my public ip in the serverlist.cs then I can get outside connections but the only internal connection I can make is on the host machine and if I leave it as null then the local net can log in and the outside connections can't
 
L

laphanso

Guest
thevermon you have the same problem as me huh? are you using a router like me?
 

David

Moderate
Both of you please post what router you are using. And have your LAN players tried using the public (Internet) ip to connect?
 

thevermon

Sorceror
I have a a netdsl1000 with a built in router and I tried to use the external for the local users but still no dice
 

Moonfire

Wanderer
I have the same problem I'm using a Netgear RO318 router, my server is a W2KSever (lastest MS updates), it is multihomed(one nic to a wireless AP) I also have a couple of persistant VPN connections. If I use my external IP I can connect thru the internet but only the server machine can log on locally, if I use my internal IP only LAN members log on. My work around right now is to have WLAN players log onto my server via PPTP (vpn) and log on as a local machine. It would be nice to have both going so again tho, before the serverlist.cs was changed I had 2 servers and address's listed and you could log on to a single game, one for the internet one for the lan both playing together.
 
Top