|
-
Jun 22nd, 2007, 02:27 AM
#1
Thread Starter
New Member
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.
-
Jun 22nd, 2007, 08:37 AM
#2
Addicted Member
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.

-
Jun 22nd, 2007, 08:57 AM
#3
Re: How to connect to a LINUX machine using VB6
-
Jun 22nd, 2007, 11:22 AM
#4
Thread Starter
New Member
Re: How to connect to a LINUX machine using VB6
How would I go about setting a listening port on the LINUX server?
-
Jun 22nd, 2007, 11:44 AM
#5
Re: How to connect to a LINUX machine using VB6
-
Jun 22nd, 2007, 12:30 PM
#6
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:
#!/usr/bin/python
# import the socket module
import socket
# the port to listen on
port = 6112
# create a TCP socket, bind it to our port, and listen
server = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
server.bind( ('', port))
server.listen(5)
while 1:
# accept a connection
client, addr = server.accept();
print "Connection from: ", addr
# while our connection is alive
while 1:
# read up to 512 bytes
data = client.recv(512)
# if it returned 0 bytes, the connection
# was closed.
if len(data) == 0:
print "Connection closed."
break
# print received data and echo it back.
print "got data: ", data
print "echoing it back!"
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.
-
Jun 25th, 2007, 10:29 PM
#7
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.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|