Java
Chilkat2 Java
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 Java Downloads
import com.chilkatsoft.chilkat2.ChilkatException;
import com.chilkatsoft.chilkat2.Socket;
public class ChilkatExample {
public static void main(String[] args) {
Socket socket = new Socket();
// Connect to the server using TLS.
boolean bTls = true;
int maxWaitMs = 5000;
try {
socket.connect("example.com", 5000, bTls, maxWaitMs);
} catch (ChilkatException e) {
System.out.println(e.getLastErrorText());
return;
}
// Restart one direction of transfer-rate measurement. Pass true to reset the receive measurement
// (RcvBytesPerSec) or false to reset the send measurement (SendBytesPerSec).
boolean bRcvPerf = true;
socket.resetPerf(bRcvPerf);
System.out.println("Receive-rate measurement restarted.");
}
}