J'utilise l'API SmartFoxServer sur Unity3d. Cela fonctionnait bien avant de récupérer mon MacBook, mais donne maintenant une erreur de connexion comme ci-dessous:
Http error creating http connection: System.Net.Sockets.SocketException: Connection refused
at System.Net.Sockets.Socket.Connect (System.Net.EndPoint remoteEP, Boolean requireSocketPolicy) [0x00000] in <filename unknown>:0
at System.Net.Sockets.Socket.Connect (System.Net.EndPoint remoteEP) [0x00000] in <filename unknown>:0
at System.Net.Sockets.TcpClient.Connect (System.Net.IPEndPoint remote_end_point) [0x00000] in <filename unknown>:0
at System.Net.Sockets.TcpClient.Connect (System.Net.IPAddress[] ipAddresses, Int32 port) [0x00000] in <filename unknown>:0
UnityEngine.Debug:Log(Object)
SFS2X_Connect:OnConnection(BaseEvent) (at Assets/SFS2X_Connect.cs:2758)
Sfs2X.Core.EventDispatcher:DispatchEvent(BaseEvent)
Sfs2X.SmartFox:ProcessEvents()
SFS2X_Connect:Update() (at Assets/SFS2X_Connect.cs:2764)
Voici le code de connexion:
using UnityEngine;
using UnityEngine.Networking;
using UnityEngine.UI;
using System.Collections;
using Sfs2X;
using Sfs2X.Core;
public class SFS2X_Connect : MonoBehaviour {
public string Host = "127.0.0.1";
[Tooltip("TCP port listened by the SmartFoxServer 2X instance; used for regular socket connection in all builds except WebGL")]
public int TcpPort = 9933;
[Tooltip("WebSocket port listened by the SmartFoxServer 2X instance; used for in WebGL build only")]
public int WSPort = 8888;
[Tooltip("Name of the SmartFoxServer 2X Zone to join")]
public string Zone = "examplezone";
SmartFox sfs;
sfs = new SmartFox ();
sfs.ThreadSafeMode = false;
sfs.AddEventListener (SFSEvent.CONNECTION, OnConnection);
ConfigData cfg = new ConfigData();
cfg.Host = Host;
cfg.Port = TcpPort;
cfg.Zone = Zone;
sfs.Connect (cfg);
}
J'ai supprimé et réimporté smartfox.dll
mais je rencontre toujours la même erreur.
Que puis-je faire?
Remarque: je crée un nouveau projet et importe SnartFoxServer. C'est connecté au serveur.