Unity SmartfoxServer Connection Error

Post here your questions about the Unity / .Net / Mono / Windows 8 / Windows Phone 8 API for SFS2X

Moderators: Lapo, Bax

moonlife
Posts: 45
Joined: 26 Sep 2016, 08:22

Unity SmartfoxServer Connection Error

Postby moonlife » 21 Aug 2017, 17:16

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
User avatar
Bax
Site Admin
Posts: 4609
Joined: 29 Mar 2005, 09:50
Location: Italy
Contact:

Re: Unity SmartfoxServer Connection Error

Postby Bax » 22 Aug 2017, 08:10

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.
Paolo Bax
The SmartFoxServer Team
moonlife
Posts: 45
Joined: 26 Sep 2016, 08:22

Re: Unity SmartfoxServer Connection Error

Postby moonlife » 22 Aug 2017, 10:02

How can I send privately server IP address?
User avatar
Bax
Site Admin
Posts: 4609
Joined: 29 Mar 2005, 09:50
Location: Italy
Contact:

Re: Unity SmartfoxServer Connection Error

Postby Bax » 22 Aug 2017, 10:14

Send us and email: info AT smartfoxserver DOT com
Paolo Bax
The SmartFoxServer Team
moonlife
Posts: 45
Joined: 26 Sep 2016, 08:22

Re: Unity SmartfoxServer Connection Error

Postby moonlife » 22 Aug 2017, 11:26

I've sent email to info AT smartfoxserver DOT com
User avatar
Bax
Site Admin
Posts: 4609
Joined: 29 Mar 2005, 09:50
Location: Italy
Contact:

Re: Unity SmartfoxServer Connection Error

Postby Bax » 22 Aug 2017, 13:18

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?
Paolo Bax
The SmartFoxServer Team
moonlife
Posts: 45
Joined: 26 Sep 2016, 08:22

Re: Unity SmartfoxServer Connection Error

Postby moonlife » 22 Aug 2017, 13:30

Thank you for your testing, but I created new project for test and its connected properly, but my main project cannot connect :(
User avatar
Bax
Site Admin
Posts: 4609
Joined: 29 Mar 2005, 09:50
Location: Italy
Contact:

Re: Unity SmartfoxServer Connection Error

Postby Bax » 22 Aug 2017, 13:41

What kind of project is that? For what target platform?
Paolo Bax
The SmartFoxServer Team
moonlife
Posts: 45
Joined: 26 Sep 2016, 08:22

Re: Unity SmartfoxServer Connection Error

Postby moonlife » 22 Aug 2017, 17:53

2d project on Unity3D, for android
User avatar
Bax
Site Admin
Posts: 4609
Joined: 29 Mar 2005, 09:50
Location: Italy
Contact:

Re: Unity SmartfoxServer Connection Error

Postby Bax » 23 Aug 2017, 06:57

Difficult to help. The server is responding, your other test works... there must be something in your code I guess.
Paolo Bax
The SmartFoxServer Team
User avatar
Lapo
Site Admin
Posts: 23008
Joined: 21 Mar 2005, 09:50
Location: Italy

Re: Unity SmartfoxServer Connection Error

Postby Lapo » 23 Aug 2017, 08:22

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
Lapo
--
gotoAndPlay()
...addicted to flash games

Return to “SFS2X C# API”

Who is online

Users browsing this forum: No registered users and 33 guests