Not logged in. · Lost password · Register
Forum: agsXMPP RSS
Avatar
Gero #1
Member since Jan 2009 · 5 posts
Group memberships: Members
Show profile · Link to this post
Subject: Can't connect to server (ASP.NET)
Hello,

I try connect to my server from my ASP.NET application. But I can't do it.

When I trying connect to my server from MiniClient it will be connected successfully.

Its my code:

void btnConnect_Click (object o, EventArgs e) {

    agsXMPP.XmppClientConnection xmpp;

    xmpp = (agsXMPP.XmppClientConnection)Application["xmpp"];
    if (xmpp == null)
    {
        xmpp = new agsXMPP.XmppClientConnection();
        Application["xmpp"] = xmpp;               
    }

    xmpp.OnLogin += new agsXMPP.ObjectHandler(xmpp_OnLogin);
    xmpp.OnReadXml += new agsXMPP.XmlHandler(xmpp_OnReadXml);
             xmpp.AutoPresence = true;
   
    xmpp.AutoResolveConnectServer   = true;

    xmpp.Port                       = 5222;          
    xmpp.UseSSL                     = false;
    xmpp.Server                     = "myserver.com";
    xmpp.Username                   = "login";
    xmpp.Password                   = "pass";
   
    xmpp.Open();
}


private void xmpp_OnLogin (object sender) {
    litConState.Text = "logged in";
}

private void xmpp_OnReadXml (object sender, string xml) {
    txtServerResult.Text += xml + "\r\n";
}

Event OnLogin not firing. I don't understand why
Avatar
Alex #2
Member since Feb 2003 · 4449 posts · Location: Germany
Group memberships: Administrators, Members
Show profile · Link to this post
did you look at the basic webclient example which ships with the SDK?
Does it work for you?

If not please post your Xml log.

Alex
Avatar
Gero #3
Member since Jan 2009 · 5 posts
Group memberships: Members
Show profile · Link to this post
? run basic webclient example wich ships with the SDK and it not working. I still have hothing.

When I trying to connect I don't get any error. How can I make XML log what you need?
Avatar
Jabberer #4
Member since Feb 2006 · 249 posts
Group memberships: Members
Show profile · Link to this post
Quote by Gero:
How can I make XML log what you need?

subscribe to the OnReadXml and OnWriteXml events.
Software Developer
AG-Software
Avatar
Gero #5
Member since Jan 2009 · 5 posts
Group memberships: Members
Show profile · Link to this post
Quote by Jabberer:
subscribe to the OnReadXml and OnWriteXml events.

I try to add OnWriteXml and OnReadXml events, but it's not firing. When I click on button (btnConnect) I have page postback and nothing else. I don't recieve any error. Can I debug connecting process other way?
Avatar
Alex #6
Member since Feb 2003 · 4449 posts · Location: Germany
Group memberships: Administrators, Members
Show profile · Link to this post
add the source or a debug version of agsXMPP to your code and start debugging with the Xmpp.Open call.

Alex
Avatar
Gero #7
Member since Jan 2009 · 5 posts
Group memberships: Members
Show profile · Link to this post
Sorry, Alex, but I don't use VS2008. I have only VS2005. Do you have WebClient example for VS2005?
Avatar
Alex #8
Member since Feb 2003 · 4449 posts · Location: Germany
Group memberships: Administrators, Members
Show profile · Link to this post
Quote by Gero:
Do you have WebClient example for VS2005?

no, there is no VS2005 version. Yuu can create a empty project and add the sources.
Avatar
Gero #9
Member since Jan 2009 · 5 posts
Group memberships: Members
Show profile · Link to this post
Finally I found where is my error. This error is not an error in SDK. In xmpp_OnLoad event I try to set value in litConState.Text, but in this function it's not working (I think because this event called in another thread). In MiniClient example I saw instructions:

    if (InvokeRequired)
            {
                // Windows Forms are not Thread Safe, we need to invoke this :(
                // We're not in the UI thread, so we need to call BeginInvoke               
                BeginInvoke(new ObjectHandler(XmppCon_OnLogin), new object[] { sender});
                return;
            }

Can I use something like this in my ASP.NET page to marshal the call to the proper thread?
Avatar
lee #10
Member since May 2009 · 3 posts
Group memberships: Members
Show profile · Link to this post
In reply to post #1
Subject: I am also experiencing this problem, you are now resolved?
I am also experiencing this problem, you are now resolved? Server-side events to trigger the client can not be changed, and the winfrom Yes, I would also like to know why
Avatar
Alex #11
Member since Feb 2003 · 4449 posts · Location: Germany
Group memberships: Administrators, Members
Show profile · Link to this post
Please read other threads about this topic.
agsXMPP is running on the webserver. And by default HTTP is not a bidirectional protocol. So the webserver cannot raise events on the browser.

But there are techniques like Comet which make this possible. So you have to use them and combine them with agsXMPP. Or you have to use Silverlight and MatriX. Silverlight is running on the Browser and it much easier for you.

Alex
Avatar
lee #12
Member since May 2009 · 3 posts
Group memberships: Members
Show profile · Link to this post
Subject: On_Message () in ASP.NET how to solve? ?
On_Message () in ASP.NET how to solve? ?
Close Smaller – Larger + Reply to this post:
Verification code: VeriCode Please enter the word from the image into the text field below. (Type the letters only, lower case is okay.)
Smileys: :-) ;-) :-D :-p :blush: :cool: :rolleyes: :huh: :-/ <_< :-( :'( :#: :scared: 8-( :nuts: :-O
Special characters:
Forum: agsXMPP RSS