IpDrv
Class XBOXServerBeacon

source: C:\XIII\IpDrv\Classes\XBOXSERVERBEACON.UC
Core.Object
   |
   +--Engine.Actor
      |
      +--Engine.Info
         |
         +--Engine.InternetInfo
            |
            +--IpDrv.InternetLink
               |
               +--IpDrv.UdpLink
                  |
                  +--IpDrv.UdpBeacon
                     |
                     +--IpDrv.XBOXServerBeacon
Direct Known Subclasses:None

class XBOXServerBeacon
extends IpDrv.UdpBeacon

//============================================================================= // XBOXServerBeacon: The classe that listens for server request on the lan //=============================================================================

Function Summary
 void BeginPlay()
     
// 
 void Destroyed()
 bool Initialize()
     
//  lbouchard
 bool Uninitialize()



Source Code


00001	//=============================================================================
00002	// XBOXServerBeacon: The classe that listens for server request on the lan
00003	//=============================================================================
00004	class XBOXServerBeacon extends UdpBeacon
00005		native
00006		config
00007		transient;
00008	
00009	// <RSCODEXBOX> lbouchard
00010	native function bool DecodeBuffer(IpAddr Addr, int Count, byte B[255]);
00011	native function bool Initialize();
00012	native function bool Uninitialize();
00013	
00014	event StartServer()
00015	{
00016		BeginPlay();
00017	}
00018	// </RSCODEXBOX>
00019	
00020	function BeginPlay()
00021	{
00022	    local string URLOptions;
00023	    //local bool bIsOnLAN;
00024	    local int iIsOnLANStr;
00025	
00026	    URLOptions = Level.getLocalURL();
00027	    URLOptions = Mid(URLOptions, InStr( URLOptions, "?" ));
00028		//if (Level.Game.ParseOption ( URLOptions, "LAN" ) != "")
00029	
00030	    iIsOnLANStr = InStr(URLOptions, "?LAN?");
00031	    if (iIsOnLANStr<0)
00032	    {
00033	        Destroy();
00034	    }
00035	    else
00036	    {
00037	 		//Super.BeginPlay();
00038			log("XBOXServerBeacon started !!!");
00039			boundport = BindPort(1002, True);
00040			if ( boundport == 0 )
00041			{
00042				log( "XBOXServerBeacon failed to bind a port." );
00043				return;
00044			}
00045			Initialize();
00046			LinkMode = MODE_Binary;
00047		}
00048	}
00049	
00050	
00051	// ReceivedBinary: Called when data is received and connection mode is MODE_Binary.
00052	event ReceivedBinary( IpAddr Addr, int Count, byte B[255] )
00053	{
00054		DecodeBuffer(Addr,Count,B);
00055	}
00056	
00057	function Destroyed()
00058	{
00059		Super.Destroyed();
00060	
00061		log( "XBOXServerBeacon finished." );
00062		Uninitialize();
00063	}
00064	
00065	
00066	
00067	defaultproperties
00068	{
00069	     ServerBeaconPort=1002
00070	}

End Source Code