The problem i met now is i need to do a resuming for the file uploading if the client connection or server connection is down.
E.g: Sunset.jpg (500KB) when i upload until half of it, (332KB in the server) and unplug my connection, it will looping and try to connect to the server, after i plug back, the FTP login is success, but it throw me an exception, say that: Sunset.jpg "The process cannot access the file because it is being used by another process".
How can i solve the problem? how do i close the file opening in the server?
Expand|Select|Wrap|Line Numbers
- SendCommand("STOR " & Path.GetFileName(sFileName))
- ' Send a command to the FTP Server.
- Private Sub SendCommand(ByVal sCommand As String)
- sCommand = sCommand & ControlChars.CrLf
- Dim cmdbytes As Byte() = ASCII.GetBytes(sCommand)
- m_objClientSocket.Send(cmdbytes, cmdbytes.Length, 0)
- ReadReply()
- End Sub
- ' Read the reply from the FTP Server
- Private Sub ReadReply()
- m_sMes = ""
- m_sReply = ReadLine()
- m_iRetValue = Int32.Parse(m_sReply.Substring(0, 3))
- End Sub
- ' Read a line from the server.
- Private Function ReadLine() As String
- Dim seperator As Char = ControlChars.Lf
- Dim mess() As String
- If (bClearMes) Then
- m_sMes = ""
- End If
- Do While (True)
- Array.Clear(m_aBuffer, 0, BLOCK_SIZE)
- m_iBytes = m_objClientSocket.Receive(m_aBuffer, m_aBuffer.Length, 0)
- m_sMes += ASCII.GetString(m_aBuffer, 0, m_iBytes)