Results 1 to 4 of 4

Thread: vb2008 and ftp

  1. #1

    Thread Starter
    New Member
    Join Date
    May 2010
    Posts
    3

    vb2008 and ftp

    Hello i am currently developing a program where u send data to a ftp to server once your connected and it displays the response from the server in a listbox. my problem is that my listbox will only contain the intial banner and nothing else from the ftp server, for example once i connect and send the command USER anonymous, i dont have the response in my listbox which should be 331 Please specify the password. is there any help u guys can provide? im using winsock and will include my code below, thank you





    Public



    Class Form1




    Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles button1.Click




    On Error Resume Next

    sock.Protocol = MSWinsockLib.ProtocolConstants.sckTCPProtocol



    sock.Connect(txtip.Text, txtport.Text)

    ListBox1.Items.Add(

    "connecting to " & txtip.Text & ": " & txtport.Text & vbNewLine)




    End Sub



    Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load

    ListBox1.Anchor = AnchorStyles.Top




    End Sub



    Private Sub sock_ConnectionRequest(ByVal sender As Object, ByVal e As AxMSWinsockLib.DMSWinsockControlEvents_ConnectionRequestEvent) Handles sock.ConnectionRequest

    sock.Close()

    sock.Accept(e.requestID)




    End Sub



    Private Sub sock_DataArrival(ByVal sender As Object, ByVal e As AxMSWinsockLib.DMSWinsockControlEvents_DataArrivalEvent) Handles sock.DataArrival




    On Error Resume Next



    Dim incoming As String = "data"

    sock.GetData(incoming)

    ListBox1.Items.Add(incoming & vbNewLine)

    incoming = (

    "data")






    End Sub



    Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click




    On Error Resume Next

    sock.Close()



    If sock.CtlState = MSWinsockLib.StateConstants.sckClosed Then

    ListBox1.Items.Add(

    "disconnected from " & txtip.Text)




    End If



    End Sub



    Private Sub Button5_Click(ByVal sender As System.Object, ByVal e As System.EventArgs)

    sock.SendData(


    "NOOP")




    End Sub



    Private Sub Button3_Click(ByVal sender As System.Object, ByVal e As System.EventArgs)

    sock.SendData(


    "USER anonymous")




    End Sub



    Private Sub Button4_Click(ByVal sender As System.Object, ByVal e As System.EventArgs)

    sock.SendData(


    "PASS [email protected]")




    End Sub



    Private Sub TextBox1_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles TextBox1.TextChanged




    End Sub



    Private Sub Button6_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button6.Click




    On Error Resume Next



    Dim contact As Boolean = False

    sock.SendData(

    CStr(TextBox1.Text))




    End Sub

    End




    Class

  2. #2

    Thread Starter
    New Member
    Join Date
    May 2010
    Posts
    3

    Re: vb2008 and ftp

    does anyone have any thoughts ?

  3. #3
    Junior Member
    Join Date
    May 2005
    Location
    California
    Posts
    22

    Re: vb2008 and ftp

    Make sure that you're terminating the commands with a CRLF sequence. FTP (and most application protocols like POP3, IMAP4, SMTP, etc.) expect that the commands that you send end with a carriage-return and linfeed, that's how the server knows the command is complete.
    Mike Stefanik
    sockettools.com

  4. #4

    Thread Starter
    New Member
    Join Date
    May 2010
    Posts
    3

    Re: vb2008 and ftp

    thank you mike i actually figured that out recently. but it seems i have run into another issue. i aim trying to make my program send data to the server based on the servers response, but i keep running into issues, it seems when i attempt to log into the server my Pass password command is not be sent. but my user command is. maybe u would like to take a look at my code. if so pm me please

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