smelf1 0 Light Poster

Hi,

I am looking to write the sliding window protocol but am unsure where to start or how to do it. I read in text in a text file and display it in a label, do i need to convert the text to anything first, and also how do i send to buffers etc

Public Class Form1

    Dim Buffer(3, 5) As Object
    Dim Head As Long
    Dim Tail As Long

    Private Sub Form_Load()
        Head = 1 : Tail = 1
    End Sub

    Private Sub AddData(ByVal D1, ByVal D2, ByVal D3, ByVal D4, ByVal D5)
        Buffer(Head, 1) = D1
        Buffer(Head, 2) = D2
        Buffer(Head, 3) = D3
        Buffer(Head, 4) = D4
        Buffer(Head, 5) = D5
        Head = Head + 1
        If Head = 4 Then Head = 1
    End Sub

    Private Sub ReadData(ByVal D1, ByVal D2, ByVal D3, ByVal D4, ByVal D5)
        D1 = Buffer(Tail, 1)
        D2 = Buffer(Tail, 2)
        D3 = Buffer(Tail, 3)
        D4 = Buffer(Tail, 4)
        D5 = Buffer(Tail, 5)
        Tail = Tail + 1
        If Tail = 4 Then Tail = 1
    End Sub


    Private Sub Buttonreaddata_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Buttonreaddata.Click
        'Read in c:\message.txtx
        Dim objReader As New IO.StreamReader("C:\message.txt", System.Text.Encoding.Default)
        Dim strData As String = objReader.ReadToEnd
        objReader.Close()
        Labeldata.Text = strData
    End Sub
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.