-->
:: RunUo.Korean.Forum > About RunUo
¹®¼­ÁÖ¼Ò : http://runuo.co.kr/forum/viewtopic.php?t=574

¡Ø TOPIC TITLE : ±ÞÇÕ´Ï´Ù!


Á¦  ¸ñ : ±ÞÇÕ´Ï´Ù!
¾ÆÀ̵ð: henesis - 2004-10-07 ¸ñ 3:25 pm
....¿À·£¸¸¿¡ ±ÛÀ» ¿Ã·Áº¸´Â±º¿ä!


¼­¹öÄÄ¿¡ ¹®Á¦°¡ À־ ¸®¼ÂÀ» Çß½À´Ï´Ù.

¹°·Ð ¼­¹öµ¥ÀÌÅÍ´Â µû·Î ¹é¾÷ÇØµÎ±¸¿ä...

±×·±µ¥!

¹æÈ­º®À» ²¯À½¿¡µµ ºÒ±¸Çϰí "¼­¹öÀ̸§ is full"À̶ó°í ¶ß´Âµ¥..

-_-....

ÀÌÀ¯°¡ ¹»±î¿ä?

¡ØÀúÈñÁýÀº ·£Ä«µå°¡ 2°³À̸ç,ÇѰ³´Â '»ç¿ë¾ÈÇÔ'À¸·Î ÇØµÎ¾ú°í,
Serverlist.csÆÄÀϵµ È®ÀÎÇØºÃ°í,·Î±×ÀÎÆÄÀϵµ È®ÀÎÇØºÃ½À´Ï´Ù.
Á¦  ¸ñ : Àúµµ ±×·´´Ï´Ù.
¾ÆÀ̵ð: gptjdwkd89 - 2004-10-07 ¸ñ 6:57 pm
ÈæÈæ!!
Á¦  ¸ñ : ¸¶Áö¸· ´äº¯
¾ÆÀ̵ð: roar - 2004-10-08 ±Ý 3:27 am
// ServerList.cs ÆÄÀÏ¿¡ ÀÌ°Íµé ±×´ë·Î ¹Ù²ã³õ°í ¼­¹öÀ̸§°ú ¾ÆÀÌÇǸ¸
// ¼öÁ¤Çؼ­ ¾²½Ã¸é ±× ¹®Á¦ ÇØ°áµË´Ï´Ù. À̰ÍÀÌ ÀÌ »çÀÌÆ®¿¡¼­ ¸¶Áö¸·À¸·Î
// ´Ù´Â ±ÛÀÌ µÇ°Ú±º¿ä. ¼ÖÁ÷È÷ ³Ê¹« ÁÖÀÎÀå´ÔÀÌ ¹«°ü½ÉÇÑ °÷..
// ±×·¸´Ù°í Ȱ¿ëÇϱ⵵ ÁÁÁöµµ ¾Ê°í.. °áÁ¤ÀûÀ¸·Î Èï¹Ì »ó½Ç

using System;
using System.Net;
using System.Net.Sockets;
using Server;
using Server.Network;

namespace Server.Misc
{
public class ServerList
{
/* Address:
*
* The default setting, a value of 'null', will attempt to detect your IP address automatically:
* private const string Address = null;
*
* This detection, however, does not work for servers behind routers. If you're running behind a router, put in your IP:
* private const string Address = "12.34.56.78";
*
* If you need to resolve a DNS host name, you can do that too:
* private const string Address = "shard.host.com";
*/

public const string Address = "211.229.26.23";

public const string ServerName = "Nfriend";

public static void Initialize()
{
Listener.Port = 2593;

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

public static void EventSink_ServerList( ServerListEventArgs e )
{
//try
//{
IPAddress ipAddr;
Resolve( Address, out ipAddr );

//if ( Resolve( Address != null && !IsLocalMachine( e.State ) ? Address : Dns.GetHostName(), out ipAddr ) )
e.AddServer( ServerName, new IPEndPoint( ipAddr, Listener.Port ) );
/*else
e.Rejected = true;
}
catch
{
e.Rejected = true;
}*/
}

public static bool Resolve( string addr, out IPAddress outValue )
{
try
{
outValue = IPAddress.Parse( addr );
return true;
}
catch
{
try
{
IPHostEntry iphe = Dns.Resolve( addr );

if ( iphe.AddressList.Length > 0 )
{
outValue = iphe.AddressList[iphe.AddressList.Length - 1];
return true;
}
}
catch
{
}
}

outValue = IPAddress.None;
return false;
}

private static bool IsLocalMachine( NetState state )
{
Socket sock = state.Socket;

IPAddress theirAddress = ((IPEndPoint)sock.RemoteEndPoint).Address;

if ( IPAddress.IsLoopback( theirAddress ) )
return true;

bool contains = false;
IPHostEntry iphe = Dns.Resolve( Dns.GetHostName() );

for ( int i = 0; !contains && i < iphe.AddressList.Length; ++i )
contains = theirAddress.Equals( iphe.AddressList[i] );

return contains;
}
}
}