Sample code for 30+ languages & platforms
PowerBuilder

Restart Transfer-Rate Measurement

See more Socket/SSL/TLS Examples

Demonstrates Socket.ResetPerf, which restarts one direction of connection-level transfer-rate measurement.

Background. Pass true to reset the receive measurement (RcvBytesPerSec) or false to reset the send measurement (SendBytesPerSec).

Chilkat PowerBuilder Downloads

PowerBuilder
integer li_rc
integer li_Success
oleobject loo_Socket
integer li_BTls
integer li_MaxWaitMs
integer li_BRcvPerf

li_Success = 0

loo_Socket = create oleobject
li_rc = loo_Socket.ConnectToNewObject("Chilkat.Socket")
if li_rc < 0 then
    destroy loo_Socket
    MessageBox("Error","Connecting to COM object failed")
    return
end if

//  Connect to the server using TLS.
li_BTls = 1
li_MaxWaitMs = 5000
li_Success = loo_Socket.Connect("example.com",5000,li_BTls,li_MaxWaitMs)
if li_Success = 0 then
    Write-Debug loo_Socket.LastErrorText
    destroy loo_Socket
    return
end if

//  Restart one direction of transfer-rate measurement.  Pass 1 to reset the receive measurement
//  (RcvBytesPerSec) or 0 to reset the send measurement (SendBytesPerSec).
li_BRcvPerf = 1
loo_Socket.ResetPerf(li_BRcvPerf)
Write-Debug "Receive-rate measurement restarted."


destroy loo_Socket