Results 1 to 11 of 11

Thread: File Transfering...

  1. #1
    Guest

    Question

    Can Anyone help me out on this? From previous post, I've found out how to browse and select files using the Common Dialogue. But, comes a new problem for this poor little beginner. How do I send it out? I undestand the concept of sending messages from client and server, but, how do I send a file??

  2. #2
    Lively Member
    Join Date
    May 1999
    Location
    Singapore
    Posts
    116
    What do you mean??

    Send it thru the TCP/IP or UDP using the Winsock Control

    or copy the file to another place in the harddrive or...


  3. #3
    Guest
    sorry for not making things clear for some of you..
    I basically mean sending it thru TCP/IP..

  4. #4
    Addicted Member Mih_Flyer's Avatar
    Join Date
    Mar 2000
    Location
    some place there
    Posts
    241
    hello, i had the same problen a few weeks ago, and i found how to work it out in this forums, i don't know exactly where, but i found a ready project which shows how to send a file thru TCP/IP using winsock,,,,try to find it

  5. #5
    Addicted Member Mih_Flyer's Avatar
    Join Date
    Mar 2000
    Location
    some place there
    Posts
    241
    I found the URL, try it and let me know, i can help you with this

    http://www.vb-world.net/demos/winsock/

  6. #6
    Guest

    Exclamation

    yeah.. I've found that ready made winsock thing as well. But, still I'm facing the problem of sending it to a SPECIFIC user. Unlike sending a message, I'm unable to attach the 'user's destination' together with the file I'm intending to send. hmm.. wait.. this is a bit unclear.

    just imagine this code,
    ____________________________________________________________
    Private Sub cmdSend_Click()

    StrData = txtSendData.Text & txtReceiver.Text
    txtSendData.Text = "bla bla bla"
    txtReceiver.Text = "User 2"

    frmDataEnv.tcpClient.SendData StrData

    End Sub
    ____________________________________________________________


    with that, I can send the sentence "bla bla bla" to User 2, right?? but, I can't get it to work with files. Hope u can get what I mean here.


  7. #7
    Addicted Member Mih_Flyer's Avatar
    Join Date
    Mar 2000
    Location
    some place there
    Posts
    241
    ok, if you have a chatting programm with a 20 users for example, that means you will have 20 winsock controls, right??
    therefore, all you have to do is to send the file to the user you want to send the file to, I hope you can get what i mean coz my english is weak, for example:

    IMAGINE THAT U HAVE 20 USERS, AND YOU WANT TO SEND THE FILE TO THE USER NUMBER 12, THEN:

    Private Sub cmdSend_Click()

    StrData = txtSendData.Text
    txtSendData.Text = "bla bla bla"

    frmDataEnv.tcpClient(12).SendData StrData

    End Sub

    HOPE YOU CAN GET IT


  8. #8
    Guest
    yeah.. thanks Mih_Flyer.. that worked pretty fine..

    ehehe.. now I'm working on sending files.. and i'm now facing the problem of getting the file and saving it in a directory..

    can u help me out?

  9. #9
    Guest
    What you need to do is, load up the file like you normaly would do, and read it all the way thru end, and yo know how you store the contents in a variable? well make sure that the variable is in the data type "byte" once you do that, and then what you do is send the file the same way you send text except send them the content of the variable.. and the other side should be able to save what u sent them to a file..

  10. #10
    Guest
    ahh.. i get want u mean there Wild Ghost, but, is it too much for me ask for a sample code?
    especially on the 'saving the file' part.. thanks

  11. #11
    Guest
    Originally posted by KenC.J
    ahh.. i get want u mean there Wild Ghost, but, is it too much for me ask for a sample code?
    especially on the 'saving the file' part.. thanks
    no it's not too much to ask, but the only problem is that I don't have a code handy, there's a file transfering program on vb-world somewhere, it's as simple as it gets.. because the winsock sends what's in it's buffer, and I think the buffer is only 12k or something, if u don't do some conversions and stuff, it won't send the whole file.. I don't know if u get what I mean....

    BTW, I think someone posted a link to it already: http://www.vb-world.net/demos/winsock/


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