Foros del Web » Programación para mayores de 30 ;) » .NET »

Enviar archivo por FTP

Estas en el tema de Enviar archivo por FTP en el foro de .NET en Foros del Web. Hola a tod@s! Estoy desarrolando una aplicación (Winform, VB.NET) y necesito transferir un archivo que genero por FTP. Alguien tiene un pequeño ejemplo o información ...
  #1 (permalink)  
Antiguo 22/12/2004, 11:45
 
Fecha de Ingreso: marzo-2004
Ubicación: Valencia
Mensajes: 367
Antigüedad: 20 años, 1 mes
Puntos: 1
Enviar archivo por FTP

Hola a tod@s!
Estoy desarrolando una aplicación (Winform, VB.NET) y necesito transferir un archivo que genero por FTP.

Alguien tiene un pequeño ejemplo o información para poder orientarme un poco?

Saludos
  #2 (permalink)  
Antiguo 23/12/2004, 10:46
 
Fecha de Ingreso: marzo-2004
Ubicación: Valencia
Mensajes: 367
Antigüedad: 20 años, 1 mes
Puntos: 1
De verdad nadie sabe nada? un link aunque sea para poder empezar a buscar información

Un saludo.
  #3 (permalink)  
Antiguo 30/12/2004, 11:04
 
Fecha de Ingreso: diciembre-2004
Mensajes: 1
Antigüedad: 19 años, 4 meses
Puntos: 0
La clase y el ejemplo

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]
Atención: Estás leyendo un tema que no tiene actividad desde hace más de 6 MESES, te recomendamos abrir un Nuevo tema en lugar de responder al actual.
Respuesta




La zona horaria es GMT -6. Ahora son las 11:55.