Hi
Im trying to program a irc client and got stuck in trying to establish
multiple server connections. The core problem is, that i dont know how many
connections i will be using so i tried a array with the type tcpclient, but
it doesnt work.
my code:
Public Class IRCtest
Private con As New TcpClient <-it works with a normal var but not if i try
to make it an array.
Private Sub btncon_Click(By Val sender As System.Object, ByVal e As
System.EventArg s) Handles btncon.Click
If btncon.Text = "Connect" Then
servcount = servcount + 1
servers(0, 0) = boxserver.Text
con.Connect(box server.Text, boxport.Text)
Dim sendBytes As [Byte]() = Encoding.ASCII. GetBytes(": NICK " + txtnick.Text
+ Chr(13))
con.GetStream.W rite(sendBytes, 0, sendBytes.Lengt h)
sendBytes = Encoding.ASCII. GetBytes(": USER VITAS 0 * :VITAS IRC" + Chr(13))
con.GetStream.W rite(sendBytes, 0, sendBytes.Lengt h)
nicklist.Nodes. Add(servcount + ",0", boxserver.Text)
btncon.Text = "Disconnect "
Else
con.Client.Clos e()
btncon.Text = "Connect"
End If
End Sub
Private Sub Timer1_Tick(ByV al sender As System.Object, ByVal e As
System.EventArg s) Handles reader.Tick
If con.GetStream.D ataAvailable Then <- this is a problem if i use arrays (it
gives a error saying, that i cant use undeclared values or something like
that)
output()
End If
End Sub
Private Sub nicklist_NodeMo useClick(ByVal sender As System.Object, ByVal e
As System.Windows. Forms.TreeNodeM ouseClickEventA rgs) Handles
nicklist.NodeMo useClick
Dim nodepath() = Split(",", nicklist.Select edNode.Name)
txtstatus.Clear ()
txtstatus.Text = serverstxt(node path(0), nodepath(1)) <- ive got a tree view
control and try to make a tree of servers / channels only showing the text
of the marked one
End Sub
End Class
VITAS
Im trying to program a irc client and got stuck in trying to establish
multiple server connections. The core problem is, that i dont know how many
connections i will be using so i tried a array with the type tcpclient, but
it doesnt work.
my code:
Public Class IRCtest
Private con As New TcpClient <-it works with a normal var but not if i try
to make it an array.
Private Sub btncon_Click(By Val sender As System.Object, ByVal e As
System.EventArg s) Handles btncon.Click
If btncon.Text = "Connect" Then
servcount = servcount + 1
servers(0, 0) = boxserver.Text
con.Connect(box server.Text, boxport.Text)
Dim sendBytes As [Byte]() = Encoding.ASCII. GetBytes(": NICK " + txtnick.Text
+ Chr(13))
con.GetStream.W rite(sendBytes, 0, sendBytes.Lengt h)
sendBytes = Encoding.ASCII. GetBytes(": USER VITAS 0 * :VITAS IRC" + Chr(13))
con.GetStream.W rite(sendBytes, 0, sendBytes.Lengt h)
nicklist.Nodes. Add(servcount + ",0", boxserver.Text)
btncon.Text = "Disconnect "
Else
con.Client.Clos e()
btncon.Text = "Connect"
End If
End Sub
Private Sub Timer1_Tick(ByV al sender As System.Object, ByVal e As
System.EventArg s) Handles reader.Tick
If con.GetStream.D ataAvailable Then <- this is a problem if i use arrays (it
gives a error saying, that i cant use undeclared values or something like
that)
output()
End If
End Sub
Private Sub nicklist_NodeMo useClick(ByVal sender As System.Object, ByVal e
As System.Windows. Forms.TreeNodeM ouseClickEventA rgs) Handles
nicklist.NodeMo useClick
Dim nodepath() = Split(",", nicklist.Select edNode.Name)
txtstatus.Clear ()
txtstatus.Text = serverstxt(node path(0), nodepath(1)) <- ive got a tree view
control and try to make a tree of servers / channels only showing the text
of the marked one
End Sub
End Class
VITAS
Comment