Results 1 to 4 of 4

Thread: [RESOLVED] Winsock Request

  1. #1

    Thread Starter
    Hyperactive Member
    Join Date
    Dec 2007
    Location
    Canada
    Posts
    297

    Resolved [RESOLVED] Winsock Request

    I have a Winsock component setup right now on my network, exact same as whats in this thread

    I would like to know if a similar control can be built using Winsock to do this:


    1) Connect to a remote computer, by IP address. (I have a code that determines the IP address of the remote machine already..)

    2) Open a .txt file, send it back to (my) the users computer and displays it in a text box on screen.

    3) On command button press, take what ever is in my text box, and send the file back to the remote computer and save it.

    Kind of like editing a configuration file, remotly.

    I know the application would have to be running on the remote end as well as my end for this to work, if its at all possible.

    I would really like to do this, I appeciate everyones help in advance!

  2. #2
    Interweb adm/o/distrator Paul M's Avatar
    Join Date
    Nov 2006
    Location
    Australia, Melbourne
    Posts
    2,306

    Re: Winsock Request

    The remote computer will need to have a server like application running so it can send the text file or just the text inside the file. Thats how i would do it.

  3. #3
    PowerPoster
    Join Date
    Jul 2006
    Location
    Maldon, Essex. UK
    Posts
    6,334

    Re: Winsock Request

    WX Man it's a combination of the Serial Port file transfer we did in your other thread, and the Winsock Client / Server.

    Something like the attached

    This time I've tested it - not thoroughly - with a couple of files.

    It should be fairly intuitive, run the project and type in the server adderss (localhost) into the client screen and click 'Connect'. Enter the fully qualified name of the text flie you want in the 'File Name' TextBox and click on 'Fetch File' - it should then be displayed in the TextBox. Make changes etc and click 'Send File' to send it back to the Server. (If, after you've fetched the file, you want to, you can save it under a different path / name by changing the path / name in the 'File Name' TextBox - but the path must already exist)

    I haven't commented the code as you'll notice a distinct similarity to the commented code I've already posted (and I'm feeling a bit lazy ) It's not the most efficient piece of code ever written and it will only work for files containing text (as that was the spec)

    To deploy over 2 computers, split the project into two projects one with frmServer and one with frmClient.

    Remove
    Code:
    Load frmClient
    frmClient.Visible = True
    frmClient.Left = Me.Left + Me.Width
    from the Server's Form_Load event. Install the Client and Server on the appropriate machines, run the Server and then run the Client...

    Happy Days.
    PS Can you organise some better weather for us over here please ?
    Attached Files Attached Files
    Last edited by Doogle; Jan 6th, 2008 at 03:56 AM.

  4. #4

    Thread Starter
    Hyperactive Member
    Join Date
    Dec 2007
    Location
    Canada
    Posts
    297

    Re: Winsock Request

    Doogle, you've done it again! Thanks!

    Quote Originally Posted by Doogle
    PS Can you organise some better weather for us over here please ?
    I'll see what I can do :P

    Cheers!
    Last edited by wxmancanada; Jan 6th, 2008 at 06:01 PM.

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