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 1 6291
Why not using an Array List and adding to it the new TcpClient object? Then,
when the coms between client-server are finished removing it from the list.
I am doing this with sockets and it works perfect.
Regards
GM.
"VITAS" <V@w23.de> wrote in message
news:43***********************@news.kamp.net... 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
This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics
by: noah |
last post by:
Does PHP have a feature to associate Cookie sessions with a persistent
database connection that will allow a single transaction across
multiple HTTP requests?
Here is how I imagine my process: I...
|
by: Gabriel Jiva |
last post by:
I have a Python app, spam.py, that uses a C shared library, eggs.so.
This shared library is an interface that makes connections to another
system (Ham), and among other things uses callback...
|
by: Paul A. Steckler |
last post by:
I need to write a TCP/IP server in C# that can handle multiple connections.
My first try was to use TCPListener instances in multiple .NET threads.
Of course, I got an exception from...
|
by: Quiet Man |
last post by:
Hi all,
I'm designing a fairly simple service that will run on W2K/SP4 and W2K3
servers. It's job is to be a very specialized database server that listens
on a given IP address / TCP port and...
|
by: Abhishek Srivastava |
last post by:
Hello All,
In IIS 6.0 We have a concept of worker processes and application pools.
As I understand it, we can have multiple worker process per appliction
pool. Each worker process is dedicated...
|
by: jasonsgeiger |
last post by:
From: "Factor" <jasonsgeiger@gmail.com>
Newsgroups: microsoft.public.in.csharp
Subject: Multiple Clients, One port
Date: Wed, 19 Apr 2006 09:36:02 -0700
I'm been working with sockets for a...
|
by: Yelena Varshal via AccessMonster.com |
last post by:
Hello,
What are the pre-requisites / conditions for the ability to create
multiple connections to MS ACCESS database and what is the precedence of its
application? adModeShareDenyNone in the code,...
|
by: D. Yates |
last post by:
Hi,
I'm about to embark on a project that will both send and receive information
to/from our client computers in the field.
The area that I still need to finalize is the method of...
|
by: sracherla |
last post by:
I am trying to write a simple windows service that accepts an incoming
request; receives a string input and sends a string output. I need this
connection to stay alive until the client closes it....
|
by: keerthyragavendran |
last post by:
hi
i'm downloading a single file using multiple threads...
how can i specify a particular range of bytes alone from a single
large file... for example say if i need only bytes ranging from...
|
by: emmanuelkatto |
last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud.
Please let me know.
Thanks!
Emmanuel
|
by: nemocccc |
last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
|
by: Hystou |
last post by:
There are some requirements for setting up RAID:
1. The motherboard and BIOS support RAID configuration.
2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
|
by: marktang |
last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
|
by: Hystou |
last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
|
by: jinu1996 |
last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
|
by: Hystou |
last post by:
Overview:
Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
|
by: tracyyun |
last post by:
Dear forum friends,
With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
|
by: conductexam |
last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
| |