Page 1 of 1

Unity SmartfoxServer Connection Error

Posted: 21 Aug 2017, 17:16
by moonlife
Hi,

I use Smartfoxserver api with Unity3d, connection was working properly before 2 days ago, but now it's not working,

it gives an error as shown below

Code: Select all

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)


here is code :

Code: Select all

using UnityEngine;
using UnityEngine.Networking;
using UnityEngine.UI;
using System.Collections;
using Sfs2X;
using Sfs2X.Core;

public class SFS2X_Connect : MonoBehaviour {

   [Tooltip("IP address or domain name of the SmartFoxServer 2X instance")]
   public string Host = "xxx.xxx.xxx.xx";

   [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 = "ZoneEx";



   //----------------------------------------------------------
   // UI elements
   //----------------------------------------------------------
   SmartFox sfs;

      sfs = new SmartFox ();

      sfs.ThreadSafeMode = false;

     sfs.AddEventListener (SFSEvent.CONNECTION, OnConnection);

ConfigData cfg = new ConfigData();

               Debug.Log ("is : "+isimsoyisim);

               cfg.Host = Host;
               cfg.Port = TcpPort;
               cfg.Zone = "Poker";


               //sfs.Connect (Host, TcpPort);
               
               sfs.Connect (cfg);

}



How can fix this?

Please assist on me

Thank you

Re: Unity SmartfoxServer Connection Error

Posted: 22 Aug 2017, 08:10
by Bax
The connection code looks good. Also, if it was working 2 days ago, I suppose something changed in your network (client side or server side). If you send us privately the IP address or host name, we can try to connect if it is an issue with the server or not.

Re: Unity SmartfoxServer Connection Error

Posted: 22 Aug 2017, 10:02
by moonlife
How can I send privately server IP address?

Re: Unity SmartfoxServer Connection Error

Posted: 22 Aug 2017, 10:14
by Bax
Send us and email: info AT smartfoxserver DOT com

Re: Unity SmartfoxServer Connection Error

Posted: 22 Aug 2017, 11:26
by moonlife
I've sent email to info AT smartfoxserver DOT com

Re: Unity SmartfoxServer Connection Error

Posted: 22 Aug 2017, 13:18
by Bax
We just tested with one of our examples and also the AdminTool.
We can connect without issues to your server (of course we can’t login with the AdminTool, but the connection is established).
I guess the problem is in your client network. Maybe you recently activated a firewall?

Re: Unity SmartfoxServer Connection Error

Posted: 22 Aug 2017, 13:30
by moonlife
Thank you for your testing, but I created new project for test and its connected properly, but my main project cannot connect :(

Re: Unity SmartfoxServer Connection Error

Posted: 22 Aug 2017, 13:41
by Bax
What kind of project is that? For what target platform?

Re: Unity SmartfoxServer Connection Error

Posted: 22 Aug 2017, 17:53
by moonlife
2d project on Unity3D, for android

Re: Unity SmartfoxServer Connection Error

Posted: 23 Aug 2017, 06:57
by Bax
Difficult to help. The server is responding, your other test works... there must be something in your code I guess.

Re: Unity SmartfoxServer Connection Error

Posted: 23 Aug 2017, 08:22
by Lapo
moonlife wrote:2d project on Unity3D, for android

If you're testing in the simulator check the android debug for more details and let us know.
See here:
http://answers.unity3d.com/questions/49 ... ogcat.html