friends i have a problem. i want to find out tcp statistics(bytes recieved&bytes send).
for this i used this code

dim a as system.net.networkinformation.tcpstatistics
dim aa as long
aa= a.bytesreceived()

this code shows a warning as

Variable ‘a’ is used before it has been assigned a value. A null reference exception could result at run time

help me to resolve this problem

another

there is any way to get detail about network connection details such as bytes send& bytes received

The simplist way is to add "New".

dim a as New system.net.networkinformation.tcpstatistics

But you still have to set it to something before using ie
a = something

great thanks for reply


i think adding new is showing some error related to "MUSTINHERIT"

then what shout be the something that should be assigned to a?

the link provided was really helpful
i was able to remove the error

here is the code

Dim properties = IPGlobalProperties.GetIPGlobalProperties()
Dim lSegmentsSend As Long
Dim lSegmentsRecieved As Long
Dim tcpstat As TcpStatistics
tcpstat = properties.GetTcpIPv4Statistics()
lSegmentsSend = tcpstat.SegmentsSent()
lSegmentsRecieved = tcpstat.SegmentsReceived()
This question has already been answered. Start a new discussion instead.