/// <summary> /// This starts the server when we click File->New Server->Host New Server. /// </summary> private void hostNewGameToolStripMenuItem_Click(object sender, EventArgs e) { Server_Shutdown(); HostServer = new Server(PlayerSettings.Settings.Host_ServerName, PlayerSettings.Settings.Host_ServerPassword); HostServer.Init(); Debug.Log(string.Format("Opened new server {0}", HostServer.ServerName)); MessageBox.Show(NetworkTools.GetLocalIPAddress()); Connect(string.Empty, PlayerSettings.Settings.Host_ServerPassword); //ClientSendMessage(BoggleInstructions.SET_NAME, PlayerSettings.Settings.Host_ServerPassword); StartServer(); //ConnectPlayer(); ServerTick.Start(); Text = string.Format("NET Boggle on {0}", HostServer.ServerName); }
private void FillIPTextBoxes() { #if DEBUG this.textBoxIPFrom.Text = "192.168.178.1"; this.textBoxIPTo.Text = "192.168.178.254"; #else var myIp = NetworkTools.GetLocalIPAddress(AddressFamily.InterNetwork); if (myIp == null || myIp == IPAddress.None) { return; } var myIPStr = myIp.ToString(); var strArr = myIPStr.Split('.'); strArr[3] = "1"; var ipFrom = string.Join(".", strArr); this.textBoxIPFrom.Text = ipFrom; strArr[3] = "254"; var ipTo = string.Join(".", strArr); this.textBoxIPTo.Text = ipTo; #endif }
private void printIPAddressToolStripMenuItem_Click(object sender, EventArgs e) { Debug.Log(NetworkTools.GetLocalIPAddress()); }