Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Sign In with Facebook Sign In with Google Sign In with OpenID

Categories

We have migrated to a new platform! Please note that you will need to reset your password to log in (your credentials are still in-tact though). Please contact lee@programmersheaven.com if you have questions.
Welcome to the new platform of Programmer's Heaven! We apologize for the inconvenience caused, if you visited us from a broken link of the previous version. The main reason to move to a new platform is to provide more effective and collaborative experience to you all. Please feel free to experience the new platform and use its exciting features. Contact us for any issue that you need to get clarified. We are more than happy to help you.

share files with friends?

stonewstonew Posts: 1Member
want to make a program so my friends and i can download files directly from each others comp. can this be done though the current ip address or port? need help gettin started, any info is appreciated.

Comments

  • KDivad LeahcimKDivad Leahcim Posts: 3,948Member
    : want to make a program so my friends and i can download files directly from each others comp. can this be done though the current ip address or port? need help gettin started, any info is appreciated.
    :

    Here is a start. It's not complete and will require some adjusting, but the idea is sound enough:

    Add a winsock control to your project and to your form.

    Set it to listen and then show IP and port:
    [code]
    Winsock1.LocalPort = 0
    Winsock1.Listen
    MsgBox "IP is: " & Winsock1.LocalIP & vbCrLf & "Port is: " & Winsock1.LocalPort
    [/code]
    Connect to another system:
    [code]
    Winsock1.Connect "123.456.789.0", 52 'IP and port. IP can be a servername
    [/code]
    Accept a connection in _ConnectRequest event. Does not have to be the same control that was listening, but Winsock must be closed before accepting:
    [code]
    Winsock1.Close
    Winsock1.Accept requestID
    [/code]
    The above code will help you to establish the connection.

    Look up SendData and GetData in the help file for help with sending and receiving info.

    If you need to, look up Open in the help file for help with reading files into memory so you can send them.

    Hope this helps,
    KDL
Sign In or Register to comment.