Abridged CodeBehind listing:
Code: Select all
using SmartFoxClientAPI;
public partial class _Default : System.Web.UI.Page
{
public SmartFoxClient sfc;
protected void Page_Load(object sender, EventArgs e)
{
SFSEvent.onDebugMessage += OnDebug;
SFSEvent.onConnection += OnConnection;
connectClient();
}
public void connectClient()
{
sfc = new SmartFoxClient(true);
sfc.Connect(ConfigurationManager.AppSettings["sfs_ip"], int.Parse(ConfigurationManager.AppSettings["sfs_port"]));
}
public void OnConnection(bool success, string error)
{
if (success)
{
Trace.Write("SFS Connection", "Connection successful");
}
else
{
Trace.Write("SFS Connection", "Connection failed. Reason: " + error);
}
}
public void OnDebug(string message)
{
Trace.Write("SFS Debug", message);
}
}
Trace output excerpt:
Code: Select all
aspx.page Begin Load
SFS Debug Trying to connect
SFS Debug [Sending]: <msg t='sys'><body action='verChk' r='0'><ver v='154' /></body></msg>
aspx.page End Load