
Bandwidth method
Returns calculated bandwidth usage.
Type
Float.Syntax
- C#
- C++
- VB.NET
float devP2P.Bandwidth(IntPtr Handle, int chanid);
The Bandwidth(Handle,chanid) syntax has these parts:
The Bandwidth(Handle,chanid) syntax has these parts:
Handle | Reference to the devP2P instance. |
chanid | Integer that specifies channel index. |
Return value | Float value representing megabytes per second bandwidth usage. |
float Bandwidth(int chanid);
The Bandwidth(chanid) syntax has these parts:
The Bandwidth(chanid) syntax has these parts:
chanid | Integer that specifies channel index. |
Return value | Float value representing megabytes per second bandwidth usage. |
Function P2P_Bandwidth(ByVal Handle As IntPtr, ByVal chanid As Integer) As Single
The Bandwidth(Handle,chanid) syntax has these parts:
The Bandwidth(Handle,chanid) syntax has these parts:
Handle | Reference to the devP2P instance. |
chanid | Integer that specifies channel index. |
Return value | Float value representing megabytes per second bandwidth usage. |
Remarks
This method returns calculated bandwidth usage for specific channel it. You can use it during, for example, file tranfers to monitor file transfer speed, since devP2P will autocalculate it for you. You can call BandwidthReset method to reset calculation just before file transfer start, to get accurate values.Code sample
- C++
void p2p_FileProgress(devP2Plib::CP2P *p2p, int chanid, int64 position, int64 size)
{
printf("%s] Progress %ld/%ld (%d%%) bandwidth=%5.2f MB/sec\r\n", p2p->MyName, (long)position, (long)size, (int)((position*100)/size), p2p->Bandwidth(chanid));
}
{
printf("%s] Progress %ld/%ld (%d%%) bandwidth=%5.2f MB/sec\r\n", p2p->MyName, (long)position, (long)size, (int)((position*100)/size), p2p->Bandwidth(chanid));
}
Platforms
WindowsMac OSX
Linux
BSD