I am creating a custom TCPDatagram object. I am using :
mTcp() as tcpClient
mNetstream() as NetworkStream
below is the actual code with my questions at the end.
Public Class TCPDatagram
Private mTcp() As TcpClient
Private mNetStream() As NetworkStream
Public Property TcpData(ByVal i As Integer) As TcpClient
Get
Return mTcp(i)
End Get
Set(ByVal Value As TcpClient)
mTcp(i) = Value
End Set
End Property
Public Property NetStream(ByVal i As Integer) As NetworkStream
Get
Return mNetStream(i)
End Get
Set(ByVal Value As NetworkStream)
mNetStream(i) = Value
End Set
End Property
Public Sub OpenDatagram(ByVal ip As String, ByVal index As Integer)
Try
'============================
ip = "192.168.155.99"
'============================
TcpData(index).Connect(ip, 4000)
NetStream(index) = TcpData(index).GetStream
Catch ex As Exception
Debug.WriteLine(ex.Message)
End Try
End Sub
Public Sub CloseDatagram(ByVal index As Integer)
Try
NetStream(index).Close()
TcpData(index).Close()
Catch ex As Exception
Debug.WriteLine(ex.Message & "," & "CloseDatagram")
End Try
End Sub
Public Sub New(ByVal index As Integer)
ReDim mTcp(index)
ReDim mNetStream(index)
End Sub
End Class 'TCPDatagram
my quetion is when i go to open the datagram through OpenDatagram, and i
pass it all the right information I am getting an instance object exception
in that procedure...but i dont know why...
my calling code instanciates the class using new, I am not inheriting from
TcpClient because I am not extending it, i am just trying to make a
connection object that uses it...any help here?
Thanks
Eric