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:
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?
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() ?
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.
Re: Bot Wont connect to IRC Server
Why Any significance to this port number?
But I think the big problem is this:
VB Code:
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.
Re: Bot Wont connect to IRC Server
Quote:
Originally Posted by Al42
Why
Any significance to this port number?
But I think the big problem is this:
VB Code:
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:
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() ?
VB Code:
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
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?
Re: Bot Wont connect to IRC Server
So, you cannot connect using mirc?
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)
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
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.
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
Re: Bot Wont connect to IRC Server
You cannot test port forwarding from the LAN side of a router by the way
Re: Bot Wont connect to IRC Server
I have other people from other countries connecting so im guessing its working ;)
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)?
Re: Bot Wont connect to IRC Server
the router ip is 192.168.1.254
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.
Re: Bot Wont connect to IRC Server
You know what... I'll probably rewrite the boat from scratch in .NET
Re: Bot Wont connect to IRC Server
:lol: Sorry wrong thread :D