Imports System
Imports System.Net
Imports System.IO
Imports System.Text
Imports System.Net.Sockets
Imports System.Windows.Forms
' Main FTP Class.
Public Class clsFTP
Public Event ServerCalled(ByVal CallMsg As String)
#Region "Main Class Variable Declarations"
Private m_sRemoteHost, m_sRemotePath, m_sRemoteUser As String
Private m_sRemotePassword, m_sMess As String
Private m_iRemotePort, m_iBytes As Int32
Private m_objClientSocket As Socket
Private m_iRetValue As Int32
Private m_bLoggedIn As Boolean ' Change to loggedIn
Private m_sMes, m_sReply As String
' Set the size of the packet that is used to read and
' write data to the FTP Server to the spcified size below.
Public Const BLOCK_SIZE = 512
Private m_aBuffer(BLOCK_SIZE) As Byte
Private ASCII As Encoding = Encoding.ASCII
' General variables
Private m_sMessageString As String
'Agregadas por ......
Private mTCPClient As New TcpClient()
Private mNetStream As NetworkStream
Private mBytes() As Byte
Private intBytesRec As Int64
Private mFTPResponse As String
Private mDataStream As NetworkStream
Private mTCPData As New TcpClient()
Private mServerAddr As IPAddress
'Para manejo de errores
Public Enum EC As Integer
NoError = 0
BuildConnectionFailed = 1
ConnectionClosingFailed = 2
DirListFailed = 3
ProttectedChannelFailed = 4
DownloadFailed = 5
UploadFailed = 6
FTPCommandFailed = 7
FTPGetFileFailed = 8
FTPPutFileFailed = 9
InvalidEntry = 30
ServerImproper = 31
ServerRejectedUser = 32
ServerRejectedPass = 33
ServerDeniedDirList = 34
InvalidFileLength = 35
DownUpLoadFailure = 36
UnknownError = 9999
End Enum
#End Region
#Region "Class Constructors"
'
' Main class constructor.
Public Sub New()
m_sRemoteHost = "100.10.10.255"
m_sRemotePath = "."
m_sRemoteUser = "user"
m_sRemotePassword = "password"
m_sMessageString = "POR DEFAULT ..."
m_iRemotePort = 21
m_bLoggedIn = False
End Sub
'Constructor Parametrizado.
Public Sub New(ByVal sRemoteHost As String, _
ByVal sRemotePath As String, _
ByVal sRemoteUser As String, _
ByVal sRemotePassword As String, _
ByVal iRemotePort As Int32)
m_sRemoteHost = sRemoteHost
m_sRemotePath = sRemotePath
m_sRemoteUser = sRemoteUser
m_sRemotePassword = sRemotePassword
m_sMessageString = ""
m_iRemotePort = iRemotePort
m_bLoggedIn = False
End Sub
#End Region
#Region "Public Properties"
'
' Set/Get the name of the FTP Server.
Public Property RemoteHost() As String
Get
Return m_sRemoteHost
End Get
Set(ByVal Value As String)
m_sRemoteHost = Value
End Set
End Property
' Set/Get the FTP Port Number.
Public Property RemotePort() As Int32
Get
Return m_iRemotePort
End Get
Set(ByVal Value As Int32)
m_iRemotePort = Value
End Set
End Property
' Set/Get the remote path.
Public Property RemotePath() As String
Get
Return m_sRemotePath
End Get
Set(ByVal Value As String)
m_sRemotePath = Value
End Set
End Property
' Set the remote password.
Public Property RemotePassword() As String
Get
Return m_sRemotePassword
End Get
Set(ByVal Value As String)
m_sRemotePassword = Value
End Set
End Property
' Set/Get the remote user.
Public Property RemoteUser() As String
Get
Return m_sRemoteUser
End Get
Set(ByVal Value As String)
m_sRemoteUser = Value
End Set
End Property
' Set the class messagestring.
Public Property MessageString() As String
Get
Return m_sMessageString
End Get
Set(ByVal Value As String)
m_sMessageString = Value
End Set
End Property
#End Region
mandame tu mail por que aqui no cabe la clase
[email protected]