Tech
Forums
Jobs
Books
Events
Videos
Conference
Annual Conference
Bcrypt
Ai Conference
Live
More
Interviews
Certification
Training
Career
Members
News
Blogs
Contribute
An Article
A Blog
A Video
An Ebook
An Interview Question
Register
Login
1
Answer
How to retrieve client bandwidth data?
Ask a question
Ask a question
Upload Source Code:
Select only zip and rar file.
haan jae
12y
1.3k
1
Reply
hello all,
i have server and client system, i used the code (from this link
http://www.m0interactive.com/archives/2008/02/06/how_to_calculate_network_bandwidth_speed_in_c_/
) at my server side, it show the bandwidth data successfully. I also include this bandwidth code in my client system, my problem is how to get the client's bandwidth so that to display at my server side??
update:
i confuse what extra codes should add in my client public partial class and the bandwidth class. In my server program, i had created the labels for displaying the client bandwidth, and also do not know what should be added in the server code.
it there any example of similar cases?? any example of retrieve client data from server side.
Thanks in advance, help will be appreciated.
here is the bandwidth class code:
class Bandwidth_Speed
{
private int bytesSentSpeed = 0;
private int bytesReceivedSpeed = 0;
private string Speed, InterfaceType, BytesReceived = "0", BytesSent = "0", Upload, Download, NetInterface;
private NetworkInterface[] netface;
public void InitializeNetworkInterface()
{
netface = NetworkInterface.GetAllNetworkInterfaces();
for (int i = 0; i < netface.Length; i++)
{
BytesReceived = "0";
BytesSent = "0";
for (int x = 0; x < 2; x++)
{
NetworkInterface nic = netface[i];
IPv4InterfaceStatistics interfaceStats = nic.GetIPv4Statistics();
bytesSentSpeed = (int)(interfaceStats.BytesSent - int.Parse(BytesSent)) / 1024;
bytesReceivedSpeed = (int)(interfaceStats.BytesReceived - int.Parse(BytesReceived)) / 1024;
Speed = (nic.Speed / (1024 * 1024)) + " MB";
InterfaceType = nic.NetworkInterfaceType.ToString();
BytesReceived = interfaceStats.BytesReceived.ToString();
BytesSent = interfaceStats.BytesSent.ToString();
Upload = bytesSentSpeed.ToString() + " kB/s";
Download = bytesReceivedSpeed.ToString() + " kB/s";
NetInterface = netface[i].Name;
Thread.Sleep(500);
}
}
}
}
Post
Reset
Cancel
Answers (
1
)
Next Recommended Forum
Multilingual keyboard support for C# touchscreen application
Find the maximum sum of a subsequence with the constraint