Click to See Complete Forum and Search --> : How to point variable to NetworkStream1 or NetworkStream2?


cgchris99
August 15th, 2002, 12:09 PM
I am working with tcpClients with 2 connections and have the following

NetworkStream1 = tcpClient1.GetStream
NetworkStream2 = tcpClient2.Getstream

How do I assign NS to point to NetworkStream1 or NetworkStream2 depending on
the parameters passed to the sub routine.

For example
Public Sub ReadCameraData(ByVal CamNum)
Dim NS as NetworkStream
If CamNum=1 then

If CamNum =2 then

End Sub

I just want to make sure when I call NS.DataAvailable() is the same as
calling NetworkStream1.DataAvailable()

Another example would be variable XYZ and VarA and VarB.
Conditionally point XYZ at VarA.
When you Change value of XYZ to 91838 and then check the value of VarA it too would be 91838.


I hope this make sense
Thanks for any advice

DSJ
August 15th, 2002, 12:28 PM
Unless I'm missing something....

Public Sub ReadCameraData(ByVal CamNum)
Dim NS as NetworkStream
If CamNum=1 then
NS = NETWORKSTREAM2
If CamNum =2 then
NS = NETEWORKSTREAM2
End Sub

or better yet...

Select Case CamNum
case 1
NS = NETWORKSTREAM1
case 2
NS = NETWORKSTREAM2
case else
msgbox "Error"
end select

cgchris99
August 15th, 2002, 05:05 PM
Thanks