Results 1 to 7 of 7

Thread: How to connect to a LINUX machine using VB6

  1. #1

    Thread Starter
    New Member
    Join Date
    Jun 2007
    Posts
    3

    How to connect to a LINUX machine using VB6

    Anyone know what component or where to get a tutorial on how to connect to a LINUX machine using a VB app?

    I am trying to create a WIN32 Visual Basic application that communicates with a LINUX machine. I will need to read some file info from the LINUX machine and display it in the application. If change is need I will write the change to the file.

  2. #2
    Addicted Member
    Join Date
    Feb 2006
    Location
    The Sea of Tranquility
    Posts
    252

    Re: How to connect to a LINUX machine using VB6

    Winsock will do the trick, set up a listening socket on the Linux box then let your VB app connect to it. The Linux server can then send your file through the established connection. If changes need to be made send the new file back.
    Rich

    A)bort, R)etry, I)nfluence with large hammer.
    Please take a moment to rate useful posts.

  3. #3
    I'm about to be a PowerPoster!
    Join Date
    Jan 2005
    Location
    Everywhere
    Posts
    13,647

    Re: How to connect to a LINUX machine using VB6

    Threads merged

  4. #4

    Thread Starter
    New Member
    Join Date
    Jun 2007
    Posts
    3

    Re: How to connect to a LINUX machine using VB6

    How would I go about setting a listening port on the LINUX server?

  5. #5
    I'm about to be a PowerPoster! Hack's Avatar
    Join Date
    Aug 2001
    Location
    Searching for mendhak
    Posts
    58,333

    Re: How to connect to a LINUX machine using VB6

    Moved to Linux section

  6. #6
    PowerPoster sunburnt's Avatar
    Join Date
    Feb 2001
    Location
    Boulder, Colorado
    Posts
    1,403

    Re: How to connect to a LINUX machine using VB6

    It's very similar to the way it's done on windows in C/C++, since both are implementations of the Berkley Socket API. It really depends on what programming language you want to use. If you're not familar with C/C++, you might want to use something else.

    Here's a simple python script that waits for a connection and echos whatever data is sent to it. You can run it with "python server.py" or possibly ./server.py

    server.py:
    Python Code:
    1. #!/usr/bin/python
    2. # import the socket module
    3. import socket
    4.  
    5. # the port to listen on
    6. port = 6112
    7.  
    8. # create a TCP socket, bind it to our port, and listen
    9. server = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
    10. server.bind( ('', port))
    11. server.listen(5)
    12.  
    13. while 1:
    14.     # accept a connection
    15.     client, addr = server.accept();
    16.     print "Connection from: ", addr
    17.     # while our connection is alive
    18.     while 1:
    19.         # read up to 512 bytes
    20.         data = client.recv(512)
    21.         # if it returned 0 bytes, the connection
    22.         # was closed.
    23.         if len(data) == 0:
    24.             print "Connection closed."
    25.             break
    26.        
    27.         # print received data and echo it back.
    28.         print "got data: ", data
    29.         print "echoing it back!"
    30.         client.send(data)
    Every passing hour brings the Solar System forty-three thousand miles closer to Globular Cluster M13 in Hercules -- and still there are some misfits who insist that there is no such thing as progress.

  7. #7
    Frenzied Member tr333's Avatar
    Join Date
    Nov 2004
    Location
    /dev/st0
    Posts
    1,605

    Re: How to connect to a LINUX machine using VB6

    A quick search on Google found this:
    Introduction to Visual Basic Socket Programming

    On the linux side, it all depends what language you're going to use.
    CSS layout comes in to the 21st century with flexbox!
    Just another Perl hacker,

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