Click to See Complete Forum and Search --> : Bot Wont connect to IRC Server
zerofool2005
Jul 31st, 2006, 04:49 AM
I have been trying to code a bot in VB 6.0 but it wont connect to th irc server
Dim RemoteHost As String
Dim RemotePort As String
Dim BotChan As String
Dim Botnick As String
Dim BotRealName As String
Dim RndNum As String
Private Sub Form_Load()
RandomNumb
Config
Winsock1.RemoteHost = RemoteHost
Winsock1.RemotePort = RemotePort
Winsock1.Connect
Do Until Winsock1.State = sckConnected
DoEvents: DoEvents: DoEvents: DoEvents
Loop
End Sub
Private Sub Config()
RemoteHost = "192.168.1.1"
RemotePort = 6667
LocalPort = 7425
BotChan = "#h4xx0rs"
Botnick = "0FBot" & RndNum
BotRealName = "Zerofool2005 Bot"
End Sub
Private Sub Winsock_Connect()
Winsock1.SendData "NICK " & Botnick & vbCrLf
Winsock1.SendData "USER " & Botnick & Winsock1.LocalHostName & "h4xx0rs" & ":" & BotRealName & vbCrLf
Winsock1.SendData "JOIN " & BotChan & vbCrLf
End Sub
Private Sub RandomNumb()
Randomize 'makes it random
Value = Int(1000 * Rnd)
RndNum = Str$(Value)
End Sub
This isnt a malicious bot. Its just a bot for the channel. Any ideas why it wont connect?
plenderj
Jul 31st, 2006, 02:43 PM
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() ?
zerofool2005
Jul 31st, 2006, 03:45 PM
I can connect to the IRC server suing a normal IRC client. The server is on my local network.
Al42
Jul 31st, 2006, 08:53 PM
Why LocalPort = 7425Any significance to this port number?
But I think the big problem is this: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.
plenderj
Aug 1st, 2006, 02:53 AM
Why LocalPort = 7425Any significance to this port number?
But I think the big problem is this: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.
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:
Private Sub Form_Load()
RandomNumb
Config
With Winsock1
.RemoteHost = RemoteHost
.RemotePort = RemotePort
.Connect
End With
End Sub
Also, your event sub is declared as Private Sub Winsock_Connect(), surely it should be Winsock1_Conect() ?
Private Sub Winsock1_Connect()
Winsock1.SendData "NICK " & Botnick & vbCrLf
Winsock1.SendData "USER " & Botnick & Winsock1.LocalHostName & "h4xx0rs" & ":" & BotRealName & vbCrLf
Winsock1.SendData "JOIN " & BotChan & vbCrLf
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
zerofool2005
Aug 1st, 2006, 03:42 AM
[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?
plenderj
Aug 1st, 2006, 04:01 AM
So, you cannot connect using mirc?
zerofool2005
Aug 1st, 2006, 04:02 AM
I can connect using mirc to 192.168.1.1 (local ip address). Or i can use h4xx0rs.ath.cx (public address)
x2fusion
Aug 5th, 2006, 09:03 PM
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
plenderj
Aug 6th, 2006, 05:40 AM
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.
zerofool2005
Aug 6th, 2006, 07:14 AM
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
plenderj
Aug 6th, 2006, 07:14 AM
You cannot test port forwarding from the LAN side of a router by the way
zerofool2005
Aug 6th, 2006, 07:32 AM
I have other people from other countries connecting so im guessing its working ;)
Al42
Aug 7th, 2006, 02:41 PM
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)?
zerofool2005
Aug 7th, 2006, 03:23 PM
the router ip is 192.168.1.254
Al42
Aug 7th, 2006, 04:21 PM
Okay - I always forget about those non-standard routers. :)
But you should still run a static IP on that server.
plenderj
Aug 7th, 2006, 05:05 PM
You know what... I'll probably rewrite the boat from scratch in .NET
plenderj
Aug 8th, 2006, 05:25 AM
:lol: Sorry wrong thread :D
vbforums.com
Copyright Internet.com Inc., All Rights Reserved.