Results 1 to 28 of 28

Thread: Own FTP SERVER (not client)

  1. #1

    Thread Starter
    Lively Member L0phtpDK's Avatar
    Join Date
    Mar 2001
    Location
    ILL
    Posts
    109
    Ok i did a search around this place and i could not find a single location on how to make a FTP SERVER. I'm not looking for anything all to fancy. 1 user capacity, able to get the Drive tree, download/upload, etc. Does anyone know of any pages that may have this type if infromation on it? Or, could they try and send me the coding for this?

    §tay |{ewl,
    L0phtpDK
    I have no real reason to put anything here....

  2. #2
    Guest

    Use Winsock

    If you want to make a FTP Server than your server must communicate with the client in FTP (offcoarse). To do that just setup a winsock control on port number 21(that's the standard FTP port) on your server, then learn the FTP protocol so that you know how to communicate with the cilent (in FTP) and do all your basic commands. Easy, Right?

  3. #3

    Thread Starter
    Lively Member L0phtpDK's Avatar
    Join Date
    Mar 2001
    Location
    ILL
    Posts
    109

    Yes... i Knew all of that but..

    I know the FTP codes...
    but how do you make the server (in coding form)?
    Becuase im kinda new to Vb.... err strike that...
    I VERY NEW to Vb programming (THERE I admited it ok. Are you happy now?), and you are skiping over my question. Is there anypages in here that will show, step by step? Like i said, im fimilar with the commands and the port numbers and how to tune a client/server to listen for thouse comands.

    I can ever make it (sorta) connect.
    winsock.localport(21)
    winsock.listen

    Something along the lines of that (kinda going of the top of my head). But after that.... whats next?
    I have no real reason to put anything here....

  4. #4
    PowerPoster Lethal's Avatar
    Join Date
    Oct 2000
    Location
    Ohio
    Posts
    2,496
    Here's an FTP prog.
    Attached Files Attached Files

  5. #5

    Thread Starter
    Lively Member L0phtpDK's Avatar
    Join Date
    Mar 2001
    Location
    ILL
    Posts
    109

    Uhh...

    I saw that same program
    Isnt this a client not a ftp server?
    I have no real reason to put anything here....

  6. #6
    PowerPoster Lethal's Avatar
    Join Date
    Oct 2000
    Location
    Ohio
    Posts
    2,496
    Oops...didn't see the server part.

  7. #7

    Thread Starter
    Lively Member L0phtpDK's Avatar
    Join Date
    Mar 2001
    Location
    ILL
    Posts
    109

    No probs

    Btw... how can i make it pop up in the homepage of Vb-world.net (along the side there)? Is it counted by most views, most replies, or who created?

    <--- Icon = Me trying to code this p o s
    I have no real reason to put anything here....

  8. #8
    Guest
    Try this code
    __________________
    Option Explicit

    Private Sub Form_Load()
    Winsock.LocalPort = 21 'Ftp's standard Prot
    Winsock.Listen
    End Sub


    Private Sub Winsock_ConnectionRequest(ByVal requestID As Long)
    Winsock.Close
    Winsock.Accept requestID
    End Sub

    Private Sub Winsock_DataArrival(ByVal bytesTotal As Long)
    Dim s As String
    Winsock.GetData s

    'You can now parse s to get ftp commands
    End Sub

    Private Sub Winsock_Error(ByVal Number As Integer, Description As String, ByVal Scode As Long, ByVal Source As String, ByVal HelpFile As String, ByVal HelpContext As Long, CancelDisplay As Boolean)

    Winsock.Close
    Winsock.LocalPort = 21 'Ftp's standard Prot
    Winsock.Listen
    End Sub

    Private Sub Winsock_Close()
    Winsock.Close
    Winsock.LocalPort = 21 'Ftp's standard Prot
    Winsock.Listen
    End Sub
    _________________
    This piece of code will only help in handling one request at a time. For multiple requests, use multiple winsock controls

  9. #9

    Thread Starter
    Lively Member L0phtpDK's Avatar
    Join Date
    Mar 2001
    Location
    ILL
    Posts
    109

    Thanks..

    now 2 questions/probs

    When i copy and paste the code into VB and i try and run it (i put the little winsock icon in the form window before i did though). It gives me the error: Varable not defined. And it points to.... Private Sub Form_Load()
    But it Highlights Winsock (not in yellow, but in blue)

    next thing

    Explane to me like im an idoit (which shouldn't be to hard) on what next i should do? The Phase S part.

    Give each command its own function?

    ie CMD = yadda yadda yadda
    I have no real reason to put anything here....

  10. #10
    Guest
    Yeah, that is because when you put that little icon in the Form, it's default name is Winsock1, and in my code it's written Winsock. You can just change the name of the control in the form. And note that my code is just an example, it will have many problems if you use this code in an application. And remenber, you also have to parse the variable 's' to figure out commands. And one more thing, it can handle only 1 request at a time, if another PC tries to connect, the current session will be terminated and the new one will start.

  11. #11
    Guest
    Why dont you with for 10 to 15 minutes and I'll write up a proper FTP server program and attach it to another post.

  12. #12

    Thread Starter
    Lively Member L0phtpDK's Avatar
    Join Date
    Mar 2001
    Location
    ILL
    Posts
    109

    ahh thanks

    told ya i was a beginner..
    now i got it to recive commands... but my server has no idea what they mean...
    That i will working (with many trips here along the way).

    I under stand that it can only handle 1 connection. I only want 1 connection anyways. So how do make it to stop listening to that port once a computer is connected?

    Change the Listening port to something like 22 after the client has connected? Or will that disconnect the computer/client on the port 21 allready? I want to make it compleatly unavailable (if possable) to the outside world once something connects to it.

    Also what do you mean the "phase" something (i get where the varable s comes from).
    I have no real reason to put anything here....

  13. #13

    Thread Starter
    Lively Member L0phtpDK's Avatar
    Join Date
    Mar 2001
    Location
    ILL
    Posts
    109

    Angry

    Boy, after reading my messages i just realized that i probaly have worst english in the world (or probaly just this form). Gezzz i need to learn to proof read my messages before i send them out.
    I have no real reason to put anything here....

  14. #14
    Guest
    Try this:
    _______________
    Option Explicit

    Private Sub Form_Load()
    Winsock.LocalPort = 21
    Winsock.Listen
    End Sub

    Private Sub Winsock_Close()
    Winsock.Close
    End Sub


    Private Sub Winsock_ConnectionRequest(ByVal requestID As Long)
    Winsock.Close
    Winsock.Accept requestID
    End Sub

    Private Sub Winsock_DataArrival(ByVal bytesTotal As Long)
    Dim s As String
    Winsock.GetData s

    Select Case UCASE(s)
    Case "LIST"
    'you can do whatsoever
    Case "CDUP"
    'you can do whatsoever
    End Select
    End Sub

    Private Sub Winsock_Error(ByVal Number As Integer, Description As String, ByVal Scode As Long, ByVal Source As String, ByVal HelpFile As String, ByVal HelpContext As Long, CancelDisplay As Boolean)

    Winsock.Close
    End Sub
    __________________
    This will only accept 1 connection. After that session is over, it will not accept anymore connections. I've also showed an example of how to parse.

  15. #15

    Thread Starter
    Lively Member L0phtpDK's Avatar
    Join Date
    Mar 2001
    Location
    ILL
    Posts
    109
    ok thanks
    ill have to do the rest on my own.

    §tay |{ewl,
    L0phtpDK
    I have no real reason to put anything here....

  16. #16
    Guest
    If you need more help you can contact me on my email address: [email protected]

  17. #17

    Thread Starter
    Lively Member L0phtpDK's Avatar
    Join Date
    Mar 2001
    Location
    ILL
    Posts
    109

    Accepted 268

    ok... I sent a Pm but i dont think that u got it...
    but it wont hurt to ask around though

    OK, i edited part of the coding so that i can put in a Debug.Print comand in there:

    Code:
    Private Sub Winsock_ConnectionRequest(ByVal requestID As Long)
    Winsock.Close
    Winsock.Accept requestID
    Debug.Print "Accepted " & requestID
    End Sub
    Now, it returns with (in the immediate box) with this:

    Accepted 268

    What does this mean? And what do i do after this ID has been accepted?
    I have no real reason to put anything here....

  18. #18
    Guest
    The request ID is a number that helps the Visual Basic to keep track of all its requests. All you have to do is accept the Id that is requesting the connection. If you want to know th Ip address of the person requesting the Connection:

    1) Accept the ID
    2) Type:
    MsgBox Winsock.RemoteHostIP
    that will tell you the person's ip. If you dont want that person to connect reset the connection:
    Winsock.Close
    Winsock.LocalPort = 21
    Winsock.Listen

  19. #19

    Thread Starter
    Lively Member L0phtpDK's Avatar
    Join Date
    Mar 2001
    Location
    ILL
    Posts
    109
    how do i accept it?
    I have no real reason to put anything here....

  20. #20
    Guest
    Just type this

    Private Sub Winsock_ConnectionRequest(ByVal requestID As Long)
    Winsock.Close
    Winsock.Accept requestID

    If winsock.RemoteHostIP <> SomeIP then
    Winsock.Close
    winsock.LocalPort = 21
    Winsocl.Listen
    End if
    End Sub

    In this code, it checks wheather the person's Ip is the one you wanted

  21. #21
    Guest
    Once the requestID is accepted you dont have to do anything with the ID

  22. #22

    Thread Starter
    Lively Member L0phtpDK's Avatar
    Join Date
    Mar 2001
    Location
    ILL
    Posts
    109
    OK typed that in...
    Used 127.0.0.1 as someIP
    and it shows 268 in the box

    now.. in my Ftp client it says

    Connecting to 127.0.0.1 port 21
    Connected, waiting for response...

    and it stays that way..

    I'm guessing its waiting for my server to send some type of command or recive some type of command

    But what?
    I have no real reason to put anything here....

  23. #23
    Guest
    Why dont we meet at some type of chat program and I could explain you the whole thing there.

  24. #24

    Thread Starter
    Lively Member L0phtpDK's Avatar
    Join Date
    Mar 2001
    Location
    ILL
    Posts
    109
    That would be great

    ICQ: 6524432
    AIM: L0phtpDK
    MIRC: I can do that
    I have no real reason to put anything here....

  25. #25
    Guest
    Where could I download ICQ from. I never tried ICQ although its very famous

  26. #26

    Thread Starter
    Lively Member L0phtpDK's Avatar
    Join Date
    Mar 2001
    Location
    ILL
    Posts
    109
    www.aim.com

    well i'm defently going to bed at 12:00
    (its 11:31 now)

    i gotta get up at 6 tommarow

    but we can still talk for a bit.
    I have no real reason to put anything here....

  27. #27
    Guest
    Im downloading it, I'll be online in 5 minutes

  28. #28

    Thread Starter
    Lively Member L0phtpDK's Avatar
    Join Date
    Mar 2001
    Location
    ILL
    Posts
    109
    ok
    ill take of a bit
    then we will continue later
    I have no real reason to put anything here....

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