Not logged in. · Lost password · Register
Forum: agsXMPP RSS
Page:  1  2  next
Avatar
Slick #1
Member since Sep 2006 · 14 posts
Group memberships: Members
Show profile · Link to this post
Subject: Connection problems
Hi Im a newbie to VB.NET and the xmpp protocol. Im trying to write a simple program in vb.net to send and recieve messages in a windows mobile 5.0 platform. See my code below:

Private Sub FUNC_OnLogin(ByVal sender As Object)
        Button1.Enabled = False
        Button2.Enabled = True
        MsgBox("test")
    End Sub

    Private Sub FUNC_OnError(ByVal sender As Object, ByVal ex As System.Exception)
        MsgBox(ex.Message)
    End Sub
    Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load



        Dim Conn As New agsXMPP.XmppClientConnection
        Dim Jid As agsXMPP.Jid
        Dim cb As agsXMPP.MessageCB

        With Conn
            AddHandler .OnLogin, AddressOf FUNC_OnLogin
            AddHandler .OnError, AddressOf FUNC_OnError

            .SocketConnectionType = agsXMPP.net.SocketConnectionType.Direct
            .Server = "trakm8.net"
            .ConnectServer = "athena.trakm8.net"
            .Username = "oluxda2020Fleet@athena.trakm8.net"
            .Password = "oluxda"
            .Port = "5222"
            .Status = "Online"
            .Priority = 5
            .AutoResolveConnectServer = True
            .RegisterAccount = False
            .Show = agsXMPP.protocol.client.ShowType.chat
            .Open()

        End With
    End Sub

when i run the above i get the following error message "A socket operation encountered a dead network".

Please any help will be very much appreciated
Avatar
Jabberer #2
Member since Feb 2006 · 249 posts
Group memberships: Members
Show profile · Link to this post
Hello Slick,

it looks like you have no network on your Mobile device or device emulator. Please setup it correctly for internet (TCP/IP) connections.

Also your code is wrong. The username is XMPP is the part in front of the "@" in your jid.

You need the ConnectServer property only if the A-Record of your XMPP server domain is different than the hostname of the server machine.
Software Developer
AG-Software
Avatar
Slick #3
Member since Sep 2006 · 14 posts
Group memberships: Members
Show profile · Link to this post
Thanks for the reply Jabberer. Now im getting a different message. "No such host is known" im guessing this probably because of the line
.Server = "trakm8.net"
am i right to think that?

Also i have managed to get the emulator on the internet but any web page i go to it says "page can not be displayed". Any ideas?
This post was edited on 2006-09-06, 17:13 by Slick.
Avatar
Alex #4
Member since Feb 2003 · 4449 posts · Location: Germany
Group memberships: Administrators, Members
Show profile · Link to this post
Hello,

i think so. Are you sure your server is configured correct?
Did you try to connect to it with another xmpp client?

Alex
Avatar
Slick #5
Member since Sep 2006 · 14 posts
Group memberships: Members
Show profile · Link to this post
Yes Alex i normally use an ocx provided by a company called trakm8. I can connect to the server using their ocx. the name of the ocx is iplxmpp.ocx. Heard of it?
Avatar
Alex #6
Member since Feb 2003 · 4449 posts · Location: Germany
Group memberships: Administrators, Members
Show profile · Link to this post
Hello,

no i never heard of it.
Do you know how your user id looks exactly? Can you post the code you use to connect with this OCX?

Alex
Avatar
Slick #7
Member since Sep 2006 · 14 posts
Group memberships: Members
Show profile · Link to this post
Here is the code bear inmind this is VB 6 code

IplXmpp1.ConnectionType = 0
   
IplXmpp1.Logon ServerUser, Password, "2020 Fleet", TrakServer, 5222, 0

where Serveruser = "olu2020Fleet"
Password = "olu"
TrakServer = "trakm8.net"
Avatar
Slick #8
Member since Sep 2006 · 14 posts
Group memberships: Members
Show profile · Link to this post
Also thought this might help

Logon(Username as string, Password as string, Resource as string, Server as string, port as integer, create new user as integer)
Avatar
Alex #9
Member since Feb 2003 · 4449 posts · Location: Germany
Group memberships: Administrators, Members
Show profile · Link to this post
so try

.Server = "trakm8.net"
.Username = "olu2020Fleet"
.Password = "your secret"
.Port = "5222"

in agsXMPP and it should work.

Alex
Avatar
Slick #10
Member since Sep 2006 · 14 posts
Group memberships: Members
Show profile · Link to this post
Thanks very much Alex. I think it does logon now but i need to send an 'available' presence before my software can pick the user up as being online. I had a look at the help files supplied with the agsXMPP but they do not help that much. Have u got any documentation on how to send presence, messages, and recieved em as well.

Cheers

Slick
Avatar
Jabberer #11
Member since Feb 2006 · 249 posts
Group memberships: Members
Show profile · Link to this post
Hello,

everything you need is in the MiniClient Sample.
The best time to send your own presence is in the OnRosterEnd Event.
You send the presence with the SendMyPresence member. Of couse you have set the correct Status, ShowType, Priority etc... if needed before.
Software Developer
AG-Software
Avatar
Slick #12
Member since Sep 2006 · 14 posts
Group memberships: Members
Show profile · Link to this post
Thanks very much Guys. When i downloaded the agsxmpp source and samples i upacked it to a folder that already had files in it so i was unaware i had the miniclient sample. Ive found it now and everything seems to make sense
Cheers Guys :)

Slick
Avatar
Slick #13
Member since Sep 2006 · 14 posts
Group memberships: Members
Show profile · Link to this post
One more thing guys. Ive been able to send messages to other users now but i cant seem to recieve from anyone. Im guessing it has something to do with .Messagegrabber. Im using the following code which i placed in the form load event.

Util.Forms.Add(Jid.Bare.ToLower(), Me)
.MesagageGrabber.Add(Jid, New BareJidComparer, AddressOf MessageCallback, Nothing)

where the jid is the jid of the person im chatting to

Cheers
Avatar
Alex #14
Member since Feb 2003 · 4449 posts · Location: Germany
Group memberships: Administrators, Members
Show profile · Link to this post
use the OnMessage event from XmppClientConnection.
The MessageGrabber can be used to grab messages by Jid.

Alex
Avatar
Slick #15
Member since Sep 2006 · 14 posts
Group memberships: Members
Show profile · Link to this post
Hi Alex

Please can u take a look at my code and tell me what im doing wrong as i can send messages from the device to any user but when i send a message back i get the following error message displayed "An error message cannot be displayed becuase an optional resource assembly containing it cannot be found" When i step throught the code the error is caused by adgsxmpp.xml.streamparser

here is my code


    Private conn As New agsXMPP.XmppClientConnection

    Dim Jid As agsXMPP.Jid

    Private Sub OutgoingMessage(ByVal msg As agsXMPP.protocol.client.Message)
       
        txtMessage.Text = msg.Body

    End Sub

    Public Sub IncomingMessage(ByVal msg As agsXMPP.protocol.client.Message)

        lstMessage.Items.Add(msg.Body)

    End Sub

    Private Sub MessageCallback(ByVal sender As Object, ByVal msg As agsXMPP.protocol.client.Message, ByVal data As Object)
        IncomingMessage(msg)
    End Sub
    Private Sub FUNC_OnLogin(ByVal sender As Object)
      
        MsgBox("Logged on")

        'lblStatus.Text = "Logged on"
    End Sub
    Private Sub FUNC_OnRosterEnd(ByVal sender As Object)
        conn.Show = agsXMPP.protocol.client.ShowType.NONE
        conn.SendMyPresence()
    End Sub
 
    Private Sub FUNC_OnMessage(ByVal sender As Object, ByVal msg As agsXMPP.protocol.client.Message)
       
        IncomingMessage(msg)

    End Sub
    Private Sub FUNC_OnError(ByVal sender As Object, ByVal ex As System.Exception)

        MsgBox(ex.Message)

    End Sub
    Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load

        Dim cb As agsXMPP.MessageCB
        Dim user As String = "olu2020Fleet@trakm8.net"

        With conn

            Jid = New agsXMPP.Jid("olu2020Fleet@trakm8.net")
            cb = New agsXMPP.MessageCB(AddressOf MessageCallback)
            Util.Forms.Add(Jid.Bare.ToLower(), Me)
            .MesagageGrabber.Add(Jid, cb, Nothing)
           
            AddHandler .OnLogin, AddressOf FUNC_OnLogin
            AddHandler .OnError, AddressOf FUNC_OnError
            AddHandler .OnRosterEnd, AddressOf FUNC_OnRosterEnd
            AddHandler .OnMessage, AddressOf FUNC_OnMessage

            .SocketConnectionType = agsXMPP.net.SocketConnectionType.Direct
            .Server = "athena.trakm8.net"
            .Username = "oluxda2020Fleet"
            .Password = "oluxda"
            .Port = "5222"
            .Status = "Online"
            .Priority = 5
            .Show = agsXMPP.protocol.client.ShowType.NONE
            .Open()
        End With
    End Sub

    Private Sub BtnSend_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles BtnSend.Click
        Dim msg As agsXMPP.protocol.client.Message = New agsXMPP.protocol.client.Message
        msg.Type = agsXMPP.protocol.client.MessageType.chat
        msg.To = Jid
        msg.Body = txtMessage.Text
        conn.Send(msg)
        OutgoingMessage(msg)
        txtMessage.Text = ""
    End Sub

    Private Sub BtnLogoff_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles BtnLogoff.Click
        'conn.Close()
        Me.Close()
    End Sub

thanks

Slick
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:
Page:  1  2  next
Forum: agsXMPP RSS