server connection

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

Moderators: Lapo, Bax

Paradox
Posts: 3
Joined: 19 May 2017, 10:53

server connection

Postby Paradox » 19 May 2017, 11:01

I trying to connect to remote server and it gives me an error.

Code:

Code: Select all

static void Main(string[] args)
        {
            SmartFox sfs = new SmartFox();
            sfs.Connect("xxx.x.xxx.xxx", 443);
            sfs.AddEventListener(SFSEvent.CONNECTION, OnConnection);
           
            Console.Read();
        }

        static void OnConnection(BaseEvent e)
        {
            if ((bool)e.Params["success"])
            {
                Console.WriteLine("success");
            }
            else
            {
                Console.WriteLine("error");
            }
        }

Error:
[SFS - ERROR] [TCPSocketLayer] Connection closed by the remote side
[SFS - ERROR] ## BlueBox Error: Error during http request: System.IO.IOException: Unable to read data from the transport connection: An existing connection was forcibly closed by the remote host. ---> System.Net.Sockets.SocketException: An existing connection was forcibly closed by the remote host
at System.Net.Sockets.Socket.Receive(Byte[] buffer, Int32 offset, Int32 size, SocketFlags socketFlags)
at System.Net.Sockets.NetworkStream.Read(Byte[] buffer, Int32 offset, Int32 size)
--- End of inner exception stack trace ---
at System.Net.Sockets.NetworkStream.Read(Byte[] buffer, Int32 offset, Int32 size)
at Sfs2X.Http.SFSWebClient.UploadValuesAsync(Uri uri, String paramName, String encodedData) at System.Net.Sockets.NetworkStream.Read(Byte[] buffer, Int32 offset, Int32 size)
at Sfs2X.Http.SFSWebClient.UploadValuesAsync(Uri uri, String paramName, String encodedData)
User avatar
Lapo
Site Admin
Posts: 19630
Joined: 21 Mar 2005, 09:50
Location: Italy

Re: server connection

Postby Lapo » 19 May 2017, 14:06

Hi,
please explain what runtime you're using? Is it standard .Net? Windows Store? Mono?

Also what API version are you using and which DLL are you using (we provide several, for different targets).

Thanks
p.s. = have you reconfigured the server to run on TCP port 443? By default SFS2X runs on 9933.
Lapo
--
gotoAndPlay()
...addicted to flash games
Paradox
Posts: 3
Joined: 19 May 2017, 10:53

Re: server connection

Postby Paradox » 19 May 2017, 17:30

Lapo wrote:Hi,
please explain what runtime you're using? Is it standard .Net? Windows Store? Mono?

Also what API version are you using and which DLL are you using (we provide several, for different targets).

Thanks
p.s. = have you reconfigured the server to run on TCP port 443? By default SFS2X runs on 9933.

It's standard .net.
I use "SmartFox2X" DLL ,version 1.7.2.
Yes, the TCP port server that I want to connect is 443.
User avatar
Lapo
Site Admin
Posts: 19630
Joined: 21 Mar 2005, 09:50
Location: Italy

Re: server connection

Postby Lapo » 19 May 2017, 18:32

Paradox wrote:
Lapo wrote:Hi,
please explain what runtime you're using? Is it standard .Net? Windows Store? Mono?

Also what API version are you using and which DLL are you using (we provide several, for different targets).

Thanks
p.s. = have you reconfigured the server to run on TCP port 443? By default SFS2X runs on 9933.

It's standard .net.
I use "SmartFox2X" DLL ,version 1.7.2.

Okay, however we distribute that .dll for 4 different platforms. I just wanted to make sure you're using the one from the "DotNet" folder in our distribution.
Can you confirm this?

Thanks
Lapo

--

gotoAndPlay()

...addicted to flash games
Paradox
Posts: 3
Joined: 19 May 2017, 10:53

Re: server connection

Postby Paradox » 20 May 2017, 07:02

Lapo wrote:
Paradox wrote:
Lapo wrote:Hi,
please explain what runtime you're using? Is it standard .Net? Windows Store? Mono?

Also what API version are you using and which DLL are you using (we provide several, for different targets).

Thanks
p.s. = have you reconfigured the server to run on TCP port 443? By default SFS2X runs on 9933.

It's standard .net.
I use "SmartFox2X" DLL ,version 1.7.2.

Okay, however we distribute that .dll for 4 different platforms. I just wanted to make sure you're using the one from the "DotNet" folder in our distribution.
Can you confirm this?

Thanks

Yes, I using dll from DotNet folder.
User avatar
Lapo
Site Admin
Posts: 19630
Joined: 21 Mar 2005, 09:50
Location: Italy

Re: server connection

Postby Lapo » 20 May 2017, 17:04

I tested your code in Mono Develop (on Mac) using the latest DLL and connecting to my local SFS2X and it works just fine.

I would recommend trying the same, i.e. testing with a local server. If this works it's likely you're unable to reach the remote server. If that's the case you should investigate what might be going on (firewall? etc...)

Let us know
Lapo

--

gotoAndPlay()

...addicted to flash games

Return to “SFS2X C# API”

Who is online

Users browsing this forum: No registered users and 6 guests