/** * @brief Retrieve client statistics of bandwidth usage and * response times. * * @see BearWare.ClientStatistics */ public bool GetClientStatistics(ref ClientStatistics lpClientStatistics) { return TTDLL.TT_GetClientStatistics(m_ttInst, ref lpClientStatistics); }
private void timer1_Tick(object sender, EventArgs e) { ClientStatistics tmp = new ClientStatistics(); if (!ttclient.GetClientStatistics(ref tmp)) return; double totalrx = (tmp.nUdpBytesRecv - statistics.nUdpBytesRecv) / 1024; double totaltx = (tmp.nUdpBytesSent - statistics.nUdpBytesSent) / 1024; double voicerx = (tmp.nVoiceBytesRecv - statistics.nVoiceBytesRecv) / 1024; double voicetx = (tmp.nVoiceBytesSent - statistics.nVoiceBytesSent) / 1024; double videorx = (tmp.nVideoCaptureBytesRecv - statistics.nVideoCaptureBytesRecv) / 1024; double videotx = (tmp.nVideoCaptureBytesSent - statistics.nVideoCaptureBytesSent) / 1024; double desktoprx = (tmp.nDesktopBytesRecv - statistics.nDesktopBytesRecv) / 1024; double desktoptx = (tmp.nDesktopBytesSent - statistics.nDesktopBytesSent) / 1024; double mediafilerx = (tmp.nMediaFileAudioBytesRecv + tmp.nMediaFileVideoBytesRecv - statistics.nMediaFileAudioBytesRecv + statistics.nMediaFileVideoBytesRecv) / 1024; double mediafiletx = (tmp.nMediaFileAudioBytesSent + tmp.nMediaFileVideoBytesSent - statistics.nMediaFileAudioBytesSent + statistics.nMediaFileVideoBytesSent) / 1024; statistics = tmp; //toolStripStatusLabel1.Text = String.Format("RX: {0:F} TX: {1:F} VoiceRX: {2:F} VoiceTX {3:F} VideoRX {4:F} VideoTX {5:F}", // totalrx, totaltx, voicerx, voicetx, videorx, videotx); toolStripStatusLabel1.Text = String.Format("RX/TX Total: {0:F}/{1:F} Voice: {2:F}/{3:F} Video: {4:F}/{5:F} Desktop: {4:F}/{5:F} Media Files: {6:F}/{7:F} in KBytes", totalrx, totaltx, voicerx, voicetx, videorx, videotx, desktoprx, desktoptx, mediafilerx, mediafiletx); }
public void TestConnectivity() { const string USERNAME = "******", PASSWORD = "******"; string NICKNAME = "TeamTalk.NET - " + GetCurrentMethod(); const UserRight USERRIGHTS = UserRight.USERRIGHT_NONE; MakeUserAccount(GetCurrentMethod(), USERNAME, PASSWORD, USERRIGHTS); TeamTalk ttclient = NewClientInstance(); Assert.IsTrue(ttclient.Connect(IPADDR, TCPPORT, UDPPORT, 0, 0, ENCRYPTED), "connect call"); Assert.IsTrue(WaitForEvent(ttclient, ClientEvent.CLIENTEVENT_CON_SUCCESS, 1000), "wait connect"); Assert.IsTrue(ttclient.Disconnect(), "disconnect"); Assert.IsTrue(ttclient.ConnectEx(IPADDR, TCPPORT, UDPPORT, "0.0.0.0", 0, 0, ENCRYPTED), "connect call"); Assert.IsTrue(WaitForEvent(ttclient, ClientEvent.CLIENTEVENT_CON_SUCCESS, 1000), "wait connect"); Login(ttclient, NICKNAME, USERNAME, PASSWORD); Assert.IsTrue(ttclient.QueryMaxPayload(0), "query payload"); TTMessage msg = new TTMessage(); Assert.IsTrue(WaitForEvent(ttclient, ClientEvent.CLIENTEVENT_CON_MAX_PAYLOAD_UPDATED, 1000, ref msg), "payload"); int payload = (int)msg.DataToObject(); Assert.IsTrue(payload > 0, "payload up"); ClientStatistics stats = new ClientStatistics(); Assert.IsTrue(ttclient.GetClientStatistics(ref stats), "got stats"); Assert.AreNotEqual(0, stats.nUdpBytesSent, "stats sent"); Assert.AreNotEqual(0, stats.nUdpBytesRecv, "stats recv"); //Assert.IsTrue(WaitCmdSuccess(ttclient, ttclient.DoQueryServerStats(), DEF_WAIT)); User[] users; Assert.IsTrue(ttclient.GetServerUsers(out users)); Channel[] channels; Assert.IsTrue(ttclient.GetServerChannels(out channels)); Assert.IsTrue(ttclient.Disconnect(), "disconnect"); }