Results 1 to 18 of 18

Thread: Bot Wont connect to IRC Server

  1. #1

    Thread Starter
    New Member
    Join Date
    Jul 2006
    Posts
    7

    Bot Wont connect to IRC Server

    I have been trying to code a bot in VB 6.0 but it wont connect to th irc server
    VB Code:
    1. Dim RemoteHost As String
    2. Dim RemotePort As String
    3. Dim BotChan As String
    4. Dim Botnick As String
    5. Dim BotRealName As String
    6. Dim RndNum As String
    7. Private Sub Form_Load()
    8. RandomNumb
    9. Config
    10. Winsock1.RemoteHost = RemoteHost
    11. Winsock1.RemotePort = RemotePort
    12. Winsock1.Connect
    13. Do Until Winsock1.State = sckConnected
    14. DoEvents: DoEvents: DoEvents: DoEvents
    15. Loop
    16. End Sub
    17.  
    18. Private Sub Config()
    19. RemoteHost = "192.168.1.1"
    20. RemotePort = 6667
    21. LocalPort = 7425
    22. BotChan = "#h4xx0rs"
    23. Botnick = "0FBot" & RndNum
    24. BotRealName = "Zerofool2005 Bot"
    25. End Sub
    26. Private Sub Winsock_Connect()
    27. Winsock1.SendData "NICK " & Botnick & vbCrLf
    28. Winsock1.SendData "USER " & Botnick & Winsock1.LocalHostName & "h4xx0rs" & ":" & BotRealName & vbCrLf
    29. Winsock1.SendData "JOIN " & BotChan & vbCrLf
    30. End Sub
    31.  Private Sub RandomNumb()
    32. Randomize 'makes it random
    33.     Value = Int(1000 * Rnd)
    34.     RndNum = Str$(Value)
    35.  End Sub

    This isnt a malicious bot. Its just a bot for the channel. Any ideas why it wont connect?

  2. #2
    Retired VBF Adm1nistrator plenderj's Avatar
    Join Date
    Jan 2001
    Location
    Dublin, Ireland
    Posts
    10,359

    Re: Bot Wont connect to IRC Server

    Can you connect using a telnet client on the same hostname and port?
    Why do you have a loop at the end of your Form_Load() ?
    Microsoft MVP : Visual Developer - Visual Basic [2004-2005]

  3. #3

    Thread Starter
    New Member
    Join Date
    Jul 2006
    Posts
    7

    Re: Bot Wont connect to IRC Server

    I can connect to the IRC server suing a normal IRC client. The server is on my local network.

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

    Re: Bot Wont connect to IRC Server

    Why
    VB Code:
    1. LocalPort = 7425
    Any significance to this port number?

    But I think the big problem is this:
    VB Code:
    1. RemoteHost = "192.168.1.1"
    Why are you trying to connect to your router? What's the IP address of the computer the server is running on? That's the address you should be trying to connect to.
    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

  5. #5
    Retired VBF Adm1nistrator plenderj's Avatar
    Join Date
    Jan 2001
    Location
    Dublin, Ireland
    Posts
    10,359

    Re: Bot Wont connect to IRC Server

    Quote Originally Posted by Al42
    Why
    VB Code:
    1. LocalPort = 7425
    Any significance to this port number?

    But I think the big problem is this:
    VB Code:
    1. RemoteHost = "192.168.1.1"
    Why are you trying to connect to your router? What's the IP address of the computer the server is running on? That's the address you should be trying to connect to.
    He doesn't use the LocalPort property (thankfully)
    192.168.1.1 isn't necessarily the IP address of his router. Like he said he can connect using an IRC client.



    Quote Originally Posted by zerofool2005
    I can connect to the IRC server suing a normal IRC client. The server is on my local network.
    Are you sure you're connecting to the same IP address when using an IRC Client?

    Try the following code:
    VB Code:
    1. Private Sub Form_Load()
    2.     RandomNumb
    3.     Config
    4.     With Winsock1
    5.         .RemoteHost = RemoteHost
    6.         .RemotePort = RemotePort
    7.         .Connect
    8.     End With
    9. End Sub

    Also, your event sub is declared as Private Sub Winsock_Connect(), surely it should be Winsock1_Conect() ?

    VB Code:
    1. Private Sub Winsock1_Connect()
    2.     Winsock1.SendData "NICK " & Botnick & vbCrLf
    3.     Winsock1.SendData "USER " & Botnick & Winsock1.LocalHostName & "h4xx0rs" & ":" & BotRealName & vbCrLf
    4.     Winsock1.SendData "JOIN " & BotChan & vbCrLf
    5. End Sub

    Also, you should wait for the RAW IRC numeric codes to come back after sending USER and NICK to ensure the bot is actually fully connected before attempting to join a channel
    Microsoft MVP : Visual Developer - Visual Basic [2004-2005]

  6. #6

    Thread Starter
    New Member
    Join Date
    Jul 2006
    Posts
    7

    Re: Bot Wont connect to IRC Server

    Code:
    [08:59:10] * Connecting to 192.168.1.1 (6667)
    -
    [08:59:11] •[h4xx0rs.ath.cx] *** Couldn't resolve your hostname; using your IP address instead
    When i use the irc client

    Whenever anybody connects to the IRCD i get notifications telling me. But i dont get any for this and the bot isnt even joinng the channel anyideas? Maybe my winsock is broke lol?

  7. #7
    Retired VBF Adm1nistrator plenderj's Avatar
    Join Date
    Jan 2001
    Location
    Dublin, Ireland
    Posts
    10,359

    Re: Bot Wont connect to IRC Server

    So, you cannot connect using mirc?
    Microsoft MVP : Visual Developer - Visual Basic [2004-2005]

  8. #8

    Thread Starter
    New Member
    Join Date
    Jul 2006
    Posts
    7

    Re: Bot Wont connect to IRC Server

    I can connect using mirc to 192.168.1.1 (local ip address). Or i can use h4xx0rs.ath.cx (public address)

  9. #9
    Lively Member
    Join Date
    Jul 2006
    Posts
    119

    Re: Bot Wont connect to IRC Server

    Thats not his IP .. Thats his routers IP .. Meaning he has a linksys router..

    Your local IP is: 192.168.1.100 if its the computer attached to the routers AUX 1

  10. #10
    Retired VBF Adm1nistrator plenderj's Avatar
    Join Date
    Jan 2001
    Location
    Dublin, Ireland
    Posts
    10,359

    Re: Bot Wont connect to IRC Server

    His router and his computer can have any IP address whatsoever, and that does not infer he has a linksys router. When using DHCP, a computer can be connected directly or indirectly to any port - IP Address assignment is not dependant on physical port numbers.
    Microsoft MVP : Visual Developer - Visual Basic [2004-2005]

  11. #11

    Thread Starter
    New Member
    Join Date
    Jul 2006
    Posts
    7

    Re: Bot Wont connect to IRC Server

    My router messed up. The ip addresses are right and the port forwarding is right because people have been on the ircd before. Once i had the local ip of 192.168.1.1 now i have 192.168.1.2 and the ircd box has 192.168.1.1 its stupid lol

  12. #12
    Retired VBF Adm1nistrator plenderj's Avatar
    Join Date
    Jan 2001
    Location
    Dublin, Ireland
    Posts
    10,359

    Re: Bot Wont connect to IRC Server

    You cannot test port forwarding from the LAN side of a router by the way
    Microsoft MVP : Visual Developer - Visual Basic [2004-2005]

  13. #13

    Thread Starter
    New Member
    Join Date
    Jul 2006
    Posts
    7

    Re: Bot Wont connect to IRC Server

    I have other people from other countries connecting so im guessing its working

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

    Re: Bot Wont connect to IRC Server

    If you want it to work regardless of the order in which computers get rebooted, you have to assign a static internal IP to the ircd computer. Otherwise internal addresses are assigned in the order in which the computers boot. If you reboot in a different order you lose the port forwarding (which is why some routers don't forward to leased addresses), because the port is now forwarded to a different computer.

    But I'm still curious why your DHCP server is set to start leasing at .1 - most routers use the .1 address for themselves. What's the router's address (the one the computers are using for a gateway)?
    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

  15. #15

    Thread Starter
    New Member
    Join Date
    Jul 2006
    Posts
    7

    Re: Bot Wont connect to IRC Server

    the router ip is 192.168.1.254

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

    Re: Bot Wont connect to IRC Server

    Okay - I always forget about those non-standard routers.

    But you should still run a static IP on that server.
    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

  17. #17
    Retired VBF Adm1nistrator plenderj's Avatar
    Join Date
    Jan 2001
    Location
    Dublin, Ireland
    Posts
    10,359

    Re: Bot Wont connect to IRC Server

    You know what... I'll probably rewrite the boat from scratch in .NET
    Microsoft MVP : Visual Developer - Visual Basic [2004-2005]

  18. #18
    Retired VBF Adm1nistrator plenderj's Avatar
    Join Date
    Jan 2001
    Location
    Dublin, Ireland
    Posts
    10,359

    Re: Bot Wont connect to IRC Server

    Sorry wrong thread
    Microsoft MVP : Visual Developer - Visual Basic [2004-2005]

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