954,500 Members — Technology Publication meets Social Media
Username:
Password:
Lost login information?
Have something to say? Contribute New Article Reply to this Article

How server retrieve client's bandwidth?

i have the server and client system. my problem is how the server enable to retrieve the client's bandwidth usage. i have the codes for bandwidth, but i am not sure how to do it because i confuse what extra codes should add in my client public partial class and the bandwidth class. As in my server program, i had created the windows forms labels for displaying the client bandwidth, and also do not know what should be added in the server code.
Please help, thank you.

here is the bandwidth class in my client side:

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);
            }
        }
    }
}
haanjae
Newbie Poster
24 posts since Sep 2011
Reputation Points: 17
Solved Threads: 0
 

update:

is Hashtable method able to solve my problem?? if so what codes should i write? because this involving two program (client and server), i confuse how the server can retrieve those bandwidth value from client.

Anyone have any idea please help, thank you so much.

haanjae
Newbie Poster
24 posts since Sep 2011
Reputation Points: 17
Solved Threads: 0
 

This article has been dead for over three months

Post: Markdown Syntax: Formatting Help
You
View similar articles that have also been tagged: