01-06-2006, 09:47 PM
Author: 22367rh
Difficulty: 1/5
:: SERVER SIDE ::
In frmServer,
Find the Data_Arrival section for the game socket. Add this code just before the end:
Find the Send_Progress section for the game socket. Add:At the end of frmServer, add:Create modBytes and add:That's all!
Difficulty: 1/5
:: SERVER SIDE ::
In frmServer,
- Add 2 Textboxes called txtBytesSent and txtBytesRecieved.
- Add 4 New Menu Items named mnuBytes, mnuKB, mnuMB, mnuGB (with the captions set to Bytes, Kilobytes, Megabytes, Gigabytes)
Find the Data_Arrival section for the game socket. Add this code just before the end:
Code:
BR.Bytes = BR.Bytes + bytesTotal
BR.KBytes = BR.Bytes / 1024
BR.MBytes = BR.KBytes / 1024
BR.GBytes = BR.MBytes / 1024
DisplayBytesRecieved
Find the Send_Progress section for the game socket. Add:
Code:
BS.Bytes = BS.Bytes + bytesSent
BS.KBytes = BS.Bytes / 1024
BS.MBytes = BS.KBytes / 1024
BS.GBytes = BS.MBytes / 1024
DisplayBytesSent
Code:
Private Sub mnuBytes_Click()
ByteMeasure = "Bytes"
UncheckAllMeasurements
mnuBytes.Checked = True
DisplayBytesRecieved
DisplayBytesSent
End Sub
Private Sub mnuGB_Click()
ByteMeasure = "GigaBytes"
UncheckAllMeasurements
mnuGB.Checked = True
DisplayBytesRecieved
DisplayBytesSent
End Sub
Private Sub mnuKB_Click()
ByteMeasure = "KiloBytes"
UncheckAllMeasurements
mnuKB.Checked = True
DisplayBytesRecieved
DisplayBytesSent
End Sub
Private Sub mnuMB_Click()
ByteMeasure = "MegaBytes"
UncheckAllMeasurements
mnuMB.Checked = True
DisplayBytesRecieved
DisplayBytesSent
End Sub
Code:
Public BS As BytesType
Public BR As BytesType
Public ByteMeasure As String
Public Type BytesType
Bytes As Long
KBytes As Long
MBytes As Long
GBytes As Long
End Type
Public Function DisplayBytesRecieved()
Dim frm As frmServer
frmServer.txtBytesRecieved.Text = ""
If ByteMeasure = "Bytes" Then
frmServer.txtBytesRecieved.Text = BR.Bytes & " B"
ElseIf ByteMeasure = "KiloBytes" Then
frmServer.txtBytesRecieved.Text = BR.KBytes & " KB"
ElseIf ByteMeasure = "MegaBytes" Then
frmServer.txtBytesRecieved.Text = BR.MBytes & " MB"
Else 'ByteMeasure = "GigaBytes"
frmServer.txtBytesRecieved.Text = BR.GBytes & " GB"
End If
End Function
Public Function DisplayBytesSent()
frmServer.txtBytesSent.Text = ""
If ByteMeasure = "Bytes" Then
frmServer.txtBytesSent.Text = BS.Bytes & " B"
ElseIf ByteMeasure = "KiloBytes" Then
frmServer.txtBytesSent.Text = BS.KBytes & " KB"
ElseIf ByteMeasure = "MegaBytes" Then
frmServer.txtBytesSent.Text = BS.MBytes & " MB"
Else 'ByteMeasure = "GigaBytes"
frmServer.txtBytesSent.Text = BS.GBytes & " GB"
End If
End Function
Sub UncheckAllMeasurements()
frmServer.mnuBytes.Checked = False
frmServer.mnuKB.Checked = False
frmServer.mnuMB.Checked = False
frmServer.mnuGB.Checked = False
End Sub