Print Page | Close Window

Basic Tutorial: Adding transfer details

Printed From: Mirage Source
Category: Tutorials
Forum Name: Approved Tutorials
Forum Discription: All tutorials shown to actually work with MSE are moved here.
URL: http://ms.shannaracorp.com/backup-forums/forum_posts.asp?TID=40
Printed Date: 20 December 2006 at 6:01pm
Software Version: Web Wiz Forums 8.01 - http://www.webwizforums.com


Topic: Basic Tutorial: Adding transfer details
Posted By: Sync
Subject: Basic Tutorial: Adding transfer details
Date Posted: 07 February 2006 at 5:59pm
Orginally posted by 22367rh

There are 2 things I must say before I begin:
1) This is my first tutorial & it is pretty basic.
2) Most people here can probably do this anyway.

Now on to the tutorial :-).

Server Side:

File: frmServer
What to do:
a) Add 2 Textboxes called txtBytesSent and txtBytesRecieved.
b) Add a 4 New Menu Items named mnuBytes, mnuKB, mnuMB, mnuGB (with the captions set to Bytes, Kilobytes, Megabytes, Gigabytes)
c) Double Click "Socket" & go to the Data_Arrival section. Add This Code just before the End Sub:
    BR.Bytes = BR.Bytes + bytesTotal
    BR.KBytes = BR.Bytes / 1024
    BR.MBytes = BR.KBytes / 1024
    BR.GBytes = BR.MBytes / 1024
        DisplayBytesRecieved

d) Stay in the "Socket" area & now go to Send_Progress. Add This Code in there:
    BS.Bytes = BS.Bytes + bytesSent
    BS.KBytes = BS.Bytes / 1024
    BS.MBytes = BS.KBytes / 1024
    BS.GBytes = BS.MBytes / 1024
        DisplayBytesSent

e) Add This Code at the end of frmServer:
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



File: modBytes        &nbs p;        ** NEEDS CREATING **
What to do:
a) Add This Code Into It:
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



That should be everything. Any problems/comments then just post below.



Replies:
Posted By: Sync
Date Posted: 07 February 2006 at 5:59pm
Approved, cool nickname


Posted By: Lord Dekon
Date Posted: 07 February 2006 at 6:01pm
Pretty cool, and did you make this?


Posted By: Sync
Date Posted: 07 February 2006 at 6:04pm
On the top of every tutorial post, there should be an "Originally posted by" ... in italics. If you see that line, then it's a post copied from the old forum.


Posted By: Lord Dekon
Date Posted: 07 February 2006 at 6:07pm
Ohhh, and I Thought we were going to switch all the stuff to the new board....


Posted By: shortybsd
Date Posted: 10 February 2006 at 2:58pm

"d) Stay in the "Socket" area & now go to Send_Progress. Add This Code in there:"

Can you post everything to get the Send_Progress to work? I noticed this server, currently only monitors incoming traffic and not outgoing. Send_Progress is no where in the code on my end. I figured there would be a Sub for OutgoingData or something



Posted By: Misunderstood
Date Posted: 10 February 2006 at 3:41pm
Private Sub Socket_SendProgress(Index As Integer, ByVal bytesSent As Long, ByVal bytesRemaining As Long)

End Sub


All I did was select Socket in the left dropdown(in frmServers code) or click on any of Sockets subs/methods(like Socket_Close) then I looked inthe right dropdown list(which contains the possible subs for that control) and found SendProgress, clicked on it and it made the default sub for it.


Posted By: shortybsd
Date Posted: 10 February 2006 at 8:17pm
cool, what about the code for that control? I am missing it from the source or was it orginally an add-on/modification/enhancement? It would be nice for the server to show bandwidth for sent data, as all the functions/subs


Posted By: Misunderstood
Date Posted: 10 February 2006 at 8:59pm
I dont think theres supposed to be anything in there except for what the tutorial says to add.



Print Page | Close Window

Bulletin Board Software by Web Wiz Forums version 8.01 - http://www.webwizforums.com
Copyright ©2001-2006 Web Wiz Guide - http://www.webwizguide.info