Show Posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.


Messages - K93

Pages: [1]
1
I fixed it by adding the following to TNTools.cs:
  1. 139: #if !UNITY_IPHONE && !UNITY_EDITOR_OSX && !UNITY_STANDALONE_OSX

2
Hello TNet,

I keep getting this SocketException on Mac OS X 10.10. Normally I program on Windows but I recently switched to Mac OS X. I tried this on Windows once and it didn't give me an exception.

I googled a bit for it and they said it could be Mono which has errors with this. Though I am not for sure and I can not find a reference. The script already has an exception if Unity is being run on the iPhone, maybe it has to be done for Mac OS X too? Sometimes if I give up the ipAddress (Not 127.0.0.1) manually. The real IP Address I mean, not the loopback address or such, it works.

Some information about my environment:
Mac OS X 10.10 Public Preview 2,
Unity 4.5.3f (Free license),
MonoDevelop bundled with Unity 3D.
TNet 1.9.7,
Irrelevant assets:
2D Toolkit and 2D Platform Controller.

If I use the game client on Mac OS X as Standalone in x86_64 mode, it crashes as soon as I click the "Connect to Server" button.

If I use the Unity Editor to try out my game and press the Connect to Server button again the Console is giving me this exception and disables the TNManager script. As soon as I enable the TNManager script it starts loading my next scene.

This is my code, I removed the irrelevant pieces like Input boxes for portNumber and ipAddress.


  1. private string ipAddress = "localhost";
  2.         private string port = "25666";
  3.  
  4.         private int channelID = 0;
  5.         private string levelName = "CharacterControllerTest";
  6.         private bool persistent = true;
  7.         private string password = "";
  8.  
  9.         private string errorMessage = "";
  10.  
  11.         private bool selectedSave = false;
  12.  
  13.         void ConnectToServerWindow (int windowID) {
  14.                 GUILayout.BeginHorizontal ();
  15.                 int portOut;
  16.                 if(int.TryParse (port, out portOut) && portOut >= 1024 && portOut <= 49151 && selectedSave) {
  17.                         if (GUILayout.Button ("Connect to Server", GUILayout.ExpandWidth (true))) {
  18.                                 errorMessage = "";
  19.                                 TNManager.Connect(ipAddress, portOut);
  20.                         }
  21.                 }
  22.                 GUILayout.EndHorizontal ();
  23.  
  24.         }
  25.  


And here the Exception:
  1. SocketException: No such host is known
  2. System.Net.Dns.hostent_to_IPHostEntry (System.String h_name, System.String[] h_aliases, System.String[] h_addrlist)
  3. System.Net.Dns.GetHostByName (System.String hostName)
  4. System.Net.Dns.GetHostEntry (System.String hostNameOrAddress)
  5. System.Net.Dns.GetHostAddresses (System.String hostNameOrAddress)
  6. TNet.Tools.get_localAddresses () (at Assets/TNet/Common/TNTools.cs:142)
  7. TNManager.Awake () (at Assets/TNet/Client/TNManager.cs:937)
  8. UnityEngine.GameObject:AddComponent()
  9. TNManager:get_instance() (at Assets/TNet/Client/TNManager.cs:361)
  10. TNManager:Connect(String, Int32) (at Assets/TNet/Client/TNManager.cs:440)
  11. StartMenuUI:ConnectToServerWindow(Int32) (at Assets/Spire/Scripts/User Interface/StartMenuUI.cs:218)
  12. UnityEngine.GUI:CallWindowDelegate(WindowFunction, Int32, GUISkin, Int32, Single, Single, GUIStyle)
  13.  

Pages: [1]