Results 1 to 13 of 13

Thread: where have i gone wrong with this irc prog code?

  1. #1

    Thread Starter
    Member
    Join Date
    Sep 2007
    Posts
    51

    where have i gone wrong with this irc prog code?

    Hi can you look at this code and see if you can see where i went
    Iv created a new project with a txtbox name txtlog and a winstock component called wskIrc

    Can you see where i have went wrong, Im meant to get a log of if it has connected and im not getting anything? any ideas?

    Code:
        Public Function addLog(ByVal Message As String)
    
            txtLog.Text = "[" & "]: " & Message & vbCrLf
    
        End Function
    
    
    
        Private Sub Form_Load()
    
            wskIrc.RemoteIP = "irc.bluehell.org"
    
            wskIrc.RemotePort = 6668
    
            addLog("Connecting to " & wskIrc.RemoteIP & " port " & wskIrc.RemotePort & "...")
    
            wskIRC.Connect()
    
        End Sub
    
    
    
        Private Sub wskIRC_Connect()
    
            addLog("Connected!")
    
            Dim Name As String
    
            Dim Random As Integer
    
            Dim Channel As String
    
            Randomize()
    
            Random = Rnd * 1000
    
            Name = "[nice]-" & Random
    
            addLog("Username: " & Name)
    
            wskIrc.Send("NICK " & Name & vbCrLf)
    
            wskIrc.Send("USER interesting" & vbCrLf)
    
            Channel = "#dhf"
    
            wskIrc.Send("JOIN " & Channel & vbCrLf)
    
        End Sub
    
    
    
        Private Sub wskIRC_DataArrival(ByVal bytesTotal As Long)
    
            Dim Data As String
    
            wskIRC.GetData(Data)
    
            addLog(Data)
    
            Dim ircCommand As String
    
            If InStr(Data, ":!") Then
    
                ircCommand = Split(Data, ":!")(1)
    
                addLog("Command: " & ircCommand)
    
            End If
    
    
    
    
    
            If InStr(Data, "PING") Then
    
                wskIrc.Send(Replace(Data, "PING", "PONG") & vbCrLf)
    
                addLog(Replace(Data, "PING", "PONG"))
    
            End If
    
    
    
            If InStr(ircCommand, "test") Then
    
                MsgBox("it works")
    
            End If
    
    
    
        End Sub

  2. #2
    I'm about to be a PowerPoster! Hack's Avatar
    Join Date
    Aug 2001
    Location
    Searching for mendhak
    Posts
    58,333

    Re: where have i gone wrong with this irc prog code?

    Are you getting an error or just nothing at all?

  3. #3

    Thread Starter
    Member
    Join Date
    Sep 2007
    Posts
    51

    Re: where have i gone wrong with this irc prog code?

    nothing @ all.. now i have done a netstat -an in a command prompt and it looks like its not connecting or trying to connect. how does it look in the code? does the code look ok and "should" it work ?

  4. #4
    I'm about to be a PowerPoster! Hack's Avatar
    Join Date
    Aug 2001
    Location
    Searching for mendhak
    Posts
    58,333

    Re: where have i gone wrong with this irc prog code?

    Yes, it looks like it should work. Are you sure about the port number?

  5. #5

    Thread Starter
    Member
    Join Date
    Sep 2007
    Posts
    51

    Re: where have i gone wrong with this irc prog code?

    Quote Originally Posted by Hack
    Yes, it looks like it should work. Are you sure about the port number?
    Hmm i dont no whats going on wiode is compatable with vb.net isnt it. Strange

  6. #6

    Thread Starter
    Member
    Join Date
    Sep 2007
    Posts
    51

    Re: where have i gone wrong with this irc prog code?

    can this be converted into .net

    Code:
    Public Function addLog(Message As String)
    
        txtLog.Text = txtLog & "[" & Time & "]: " & Message & vbCrLf
    
    End Function

  7. #7
    Frenzied Member
    Join Date
    Nov 2005
    Posts
    1,834

    Re: where have i gone wrong with this irc prog code?

    Are you sure the port number has to be 6668 ?
    The default port for IRC servers is 6667

  8. #8

    Thread Starter
    Member
    Join Date
    Sep 2007
    Posts
    51

    Re: where have i gone wrong with this irc prog code?

    iv sorted the connecting part, i think anyway. it will connect on port 6668 fine yes that is fine. My problem is i dont get any display in the txtlog text box. Can you have a look at the following code and see if you can convert it into .net

    Code:
    Public Function addLog(Message As String)
    
        txtLog.Text = txtLog & "[" & Time & "]: " & Message & vbCrLf
    
    End Function

    Its the txtlog part that is giving me the problems.

  9. #9
    Junior Member
    Join Date
    Sep 2007
    Posts
    29

    Re: where have i gone wrong with this irc prog code?

    I might be wrong but do you have to put "txtLog.Text" not just "txtLog"

  10. #10

    Thread Starter
    Member
    Join Date
    Sep 2007
    Posts
    51

    Re: where have i gone wrong with this irc prog code?

    yep tryed that but i still dont get any text apearing in my txtbox

  11. #11

    Thread Starter
    Member
    Join Date
    Sep 2007
    Posts
    51

    Re: where have i gone wrong with this irc prog code?

    I have figured it out.. well most of it.. I changed the form_load from the standard VB6 to the .net 1 which was

    Code:
        Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
    This fixed the problems.

    I now get txt on the txtlog.txt but it doenst give me information once it has connected
    Last edited by r1chyb; Sep 21st, 2007 at 05:00 AM.

  12. #12

    Thread Starter
    Member
    Join Date
    Sep 2007
    Posts
    51

    Re: where have i gone wrong with this irc prog code?

    Below is the log i get from the txtbox,

    []: Connecting to 208.99.193.130 port 6664...
    []: Username: RichyB21
    []: :swiftco.wa.us.dal.net NOTICE AUTH :*** Looking up your hostname...
    :swiftco.wa.us.dal.net NOTICE AUTH :*** Checking Ident

    []: :swiftco.wa.us.dal.net NOTICE AUTH :*** No Ident response
    :swiftco.wa.us.dal.net NOTICE AUTH :*** Found your hostname

    []: ERROR :Closing Link: 0.0.0.0 (Ping timeout)

    can you guys explain what iv done wrong and what i need to do to fix it.
    Attached Files Attached Files
    Last edited by r1chyb; Sep 21st, 2007 at 08:58 AM. Reason: fixed some things but now need help on different things

  13. #13
    PowerPoster
    Join Date
    Feb 2006
    Location
    East of NYC, USA
    Posts
    5,691

    Re: where have i gone wrong with this irc prog code?

    I can't access any IRC server from here (firewall restriction at work), but I will give you one hint - don't connect to a fixed dalnet server, it's frowned upon. Use irc.dal.net.

    Since you are getting the logging in the textbox, what's the problem? I only see 2 possibilities:

    1) You're dumping everything, not just chat, into the textbox.
    2) You're not answering pings.

    (You should also be running an Ident server - you can run mIRC with the Ident server turned on until you get your own written.)

    @Chris001:
    Most of the larger IRC networks' servers allow connections on more than one port. 6667 is almost universally accessible, but many servers are running 10 ports (or more). You have to check the MOTD to see what ports are available.
    The most difficult part of developing a program is understanding the problem.
    The second most difficult part is deciding how you're going to solve the problem.
    Actually writing the program (translating your solution into some computer language) is the easiest part.

    Please indent your code and use [HIGHLIGHT="VB"] [/HIGHLIGHT] tags around it to make it easier to read.

    Please Help Us To Save Ana

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width