Code: Select all
namespace WindowsFormsApplication1
{
public partial class Form1 : Form
{
private string ip = "127.0.0.1";
private int port = 9339;
private string status = "";
private SmartFoxClient smartFox;
private string zone = "simpleChat";
private string username = "";
private string password = "";
private bool bo;
public Form1()
{
InitializeComponent();
}
private void Form1_Load(object sender, EventArgs e)
{
this.Start();
}
void Start()
{
smartFox = new SmartFoxClient();
SFSEvent.onConnection += OnConnection;
SFSEvent.onConnectionLost += OnConnectionLost;
smartFox.Connect(ip, port);
}
//----------------------------------------------------------
// Handle connection response from server
//----------------------------------------------------------
void OnConnection(bool success, string error)
{
if (success)
label1.Text = "Connected";
else
label1.Text = "Could not connect";
}
void OnConnectionLost()
{
label1.Text = "Connection lost / no connection to server";
}
}
}
Problem is that program never triggers the function OnConnection or OnconnectionLost.
When i try to connect server , it should show the status on label1. But there is no change. When i debugged i realized that "OnConnection" was not triggered. But on the server administration panel i can see the socket connection.
Could you please help me?