Warning: file_get_contents(/data/phpspider/zhask/data//catemap/0/unity3d/4.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
C# 无法使用unity3d将远程服务器连接到smartfox_C#_Unity3d_Smartfoxserver - Fatal编程技术网

C# 无法使用unity3d将远程服务器连接到smartfox

C# 无法使用unity3d将远程服务器连接到smartfox,c#,unity3d,smartfoxserver,C#,Unity3d,Smartfoxserver,我正在尝试将smartfoxserver与unity3d连接。本地机器运转良好。但是当我在我的服务器ip上尝试xx.xx.xx.xx时,如果出现如下错误 我该怎么办 Http error creating http connection: System.Net.Sockets.SocketException: Connection refused at System.Net.Sockets.Socket.Connect (System.Net.EndPoint remoteEP, Boole

我正在尝试将smartfoxserver与unity3d连接。本地机器运转良好。但是当我在我的服务器ip上尝试xx.xx.xx.xx时,如果出现如下错误

我该怎么办

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:31)
Sfs2X.Core.EventDispatcher:DispatchEvent(BaseEvent)
Sfs2X.SmartFox:ProcessEvents()
SFS2X_Connect:Update() (at Assets/SFS2X_Connect.cs:37)

创建ConfigData,然后将其传递给sfs进行连接:

    ConfigData cfg = new ConfigData();
    cfg.Host = "x.x.x.x";
    cfg.Port = 9932;
    cfg.Zone = loginZone;
    cfg.Debug = true;
    smartFox.Connect(cfg);

谢谢,我已经接通了。但是我使用9933(没问题:),您使用的端口号取决于服务器配置,您可以使用具有不同端口的多个sfs实例:)
    ConfigData cfg = new ConfigData();
    cfg.Host = "x.x.x.x";
    cfg.Port = 9932;
    cfg.Zone = loginZone;
    cfg.Debug = true;
    smartFox.Connect(cfg);