File sending and recieving problem - Urgent

tharindufit

New member
Joined
Feb 21, 2008
Messages
1
Programming Experience
Beginner
We have written an Windows mobile code in VB to send a recorded video file to a PC server and it sends the recorded video file to the server without any error and it does not open at the server. Sometimes after recording and sending it works. (This code works fine with the emulator and the file can be opened but it always not work fine with the real phone) This makes me full upset and I can't think of any error in code.
Here are some parts of client code done ..............:confused:

VB.NET:
Private Sub startSendingVideo()
        videoClient = New TcpClient
        Dim camera As New CameraCaptureDialog()
        camera.Owner = Me
        camera.Title = "Mobi-Tube"
        camera.Mode = CameraCaptureMode.VideoWithAudio

        camera.ShowDialog()
        fileName = camera.FileName
        dataThread = New Thread(AddressOf sendVideo)
        sendUdpData = True
        videoClient.Connect(txtIP.Text, videoport)
        videoStream = videoClient.GetStream
        dataThread.Priority = ThreadPriority.BelowNormal
        dataThread.Start()

    End Sub
:confused:

VB.NET:
    Private Sub sendVideo()

        Try
            Dim wmvFile As FileStream
            Dim bytesToSend(videoclient.SendBufferSize) As Byte
            Dim FI As New FileInfo(fileName)
            Dim fileReader As BinaryReader
            Try
                wmvFile = New FileStream(fileName, FileMode.Open, FileAccess.Read)
            Catch e As Exception
                Throw e
            End Try

            fileReader = New BinaryReader(wmvFile)
            Dim numBytesRead As Integer
            Dim Ipos As Integer
            Do Until Ipos >= FI.Length
                numBytesRead = wmvFile.Read(bytesToSend, 0, bytesToSend.Length)
                videoStream.Write(bytesToSend, 0, numBytesRead)
                Ipos = Ipos + numBytesRead
                videoStream.Flush()
            Loop

            videoStream.Flush()
            wmvFile.Close()
            fileReader.Close()
           

        Catch e As Exception
        End Try

    End Sub
Server code is normal VB and it reads the file
Please can anybody help me on this. Now I am completely fed up with this
 
Back
Top