Results 1 to 6 of 6

Thread: [RESOLVED] Save UDP data to file

Threaded View

  1. #1

    Thread Starter
    Hyperactive Member
    Join Date
    Sep 2007
    Location
    Sweden
    Posts
    359

    Resolved [RESOLVED] Save UDP data to file

    Hi, all
    I have an application that listen to a port, and receives UDP data. The data is sent to a textbox.
    I want to add a checkbox, and when the checkbox is =1 then I want the UDP data to be saved to a file on desktop named with date and time.

    I made this code, and it does the job. But it doesn't make a new file when I check and uncheck the checkbox. I can only make one log, then I need to restart my program, to make a new log.

    Private Sub sckUDP_DataArrival(ByVal bytesTotal As Long)

    On Error Resume Next
    If Err Then MsgBox Error$, 48
    Dim filelocation As String
    Dim strData As String

    sckUDP.GetData strData 'Retrieve the data
    txtReceive.Text = strData 'Display it

    If chkLog = 1 Then
    filelocation = "UDP_Log" & "-" & Format(Now, "yyyymmdd hhmmss") & ".txt"
    Open filelocation For Append As #1
    Print #1, txtReceive.Text
    If chkLog = 0 Then
    Close #1

    End If
    End If

    End Sub
    Last edited by BULK; Sep 21st, 2007 at 07:38 AM.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width