home bbs files messages ]

Forums before death by AOL, social media and spammers... "We can't have nice things"

   comp.lang.visual.basic      MS Visual Basic discussions, NOT dot-net      10,840 messages   

[   << oldest   |   < older   |   list   |   newer >   |   newest >>   ]

   Message 9,879 of 10,840   
   VITAS to All   
   multiple connections vb.net   
   30 Jan 06 11:17:29   
   
   From: V@w23.de   
      
   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(ByVal sender As System.Object, ByVal e As   
   System.EventArgs) Handles btncon.Click   
      
   If btncon.Text = "Connect" Then   
      
   servcount = servcount + 1   
      
   servers(0, 0) = boxserver.Text   
      
   con.Connect(boxserver.Text, boxport.Text)   
      
   Dim sendBytes As [Byte]() = Encoding.ASCII.GetBytes(": NICK " + txtnick.Text   
   + Chr(13))   
      
   con.GetStream.Write(sendBytes, 0, sendBytes.Length)   
      
   sendBytes = Encoding.ASCII.GetBytes(": USER VITAS 0 * :VITAS IRC" + Chr(13))   
      
   con.GetStream.Write(sendBytes, 0, sendBytes.Length)   
      
   nicklist.Nodes.Add(servcount + ",0", boxserver.Text)   
      
   btncon.Text = "Disconnect"   
      
   Else   
      
   con.Client.Close()   
      
   btncon.Text = "Connect"   
      
   End If   
      
   End Sub   
      
   Private Sub Timer1_Tick(ByVal sender As System.Object, ByVal e As   
   System.EventArgs) Handles reader.Tick   
      
   If con.GetStream.DataAvailable 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_NodeMouseClick(ByVal sender As System.Object, ByVal e   
   As System.Windows.Forms.TreeNodeMouseClickEventArgs) Handles   
   nicklist.NodeMouseClick   
      
   Dim nodepath() = Split(",", nicklist.SelectedNode.Name)   
      
   txtstatus.Clear()   
      
   txtstatus.Text = serverstxt(nodepath(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   
      
   --- SoupGate-Win32 v1.05   
    * Origin: you cannot sedate... all the things you hate (1:229/2)   

[   << oldest   |   < older   |   list   |   newer >   |   newest >>   ]


(c) 1994,  bbs@darkrealms.ca