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
Re: where have i gone wrong with this irc prog code?
Are you getting an error or just nothing at all?
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 ?
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?
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
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
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
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.
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"
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
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
1 Attachment(s)
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.
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.