Network
- AllocateViewID
- CloseConnection
- connections
- connectionTesterIP
- connectionTesterPort
- Connect
- DestroyPlayerObjects
- Destroy
- Disconnect
- GetAveragePing
- GetLastPing
- HavePublicAddress
- incomingPassword
- InitializeSecurity
- InitializeServer
- Instantiate
- isClient
- isMessageQueueRunning
- isServer
- logLevel
- maxConnections
- minimumAllocatableViewIDs
- natFacilitatorIP
- natFacilitatorPort
- OnConnectedToServer
- OnDisconnectedFromServer
- OnFailedToConnectToM...
- OnFailedToConnect
- OnNetworkInstantiate
- OnPlayerConnected
- OnPlayerDisconnected
- OnSerializeNetworkView
- OnServerInitialized
- peerType
- player
- proxyIP
- proxyPassword
- proxyPort
- RemoveRPCsInGroup
- RemoveRPCs
- sendRate
- SetLevelPrefix
- SetReceivingEnabled
- SetSendingEnabled
- TestConnectionNAT
- TestConnection
- time
- useProxy
Network.InitializeServer 初始化服务器
static function InitializeServer (connections : int, listenPort : int, useNat : bool) : NetworkConnectionError
Description描述
Initialize the server.
初始化服务器。
connections is the number of allowed incoming connections / number of players allowed in the game. listenPort is the port number we want to listen to. useNat sets the NAT punchthrough functionality. If you want this server to be able to accept connections using NAT punchthrough, using the facilitator, set this to true.
connections是允许的入站连接或玩家的数量,listenPort是要监听的端口,useNat设置NAT穿透功能。如果你想要这个服务器能够接受连接使用NAT穿透,使用facilitator,设置这个为true。
using UnityEngine;
using System.Collections;
public class example : MonoBehaviour {
void LaunchServer() {
Network.incomingPassword = "HolyMoly";
bool useNat = !Network.HavePublicAddress();
Network.InitializeServer(32, 25000, useNat);
}
}
function LaunchServer () {
Network.incomingPassword = "HolyMoly";
var useNat = !Network.HavePublicAddress();
Network.InitializeServer(32, 25000, useNat);
}
最后修改:2011年4月2日 Saturday 16:38