Click to See Complete Forum and Search --> : How to connect to a LINUX machine using VB6
rocket1356
Jun 22nd, 2007, 03:27 AM
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.
Rich2189
Jun 22nd, 2007, 09:37 AM
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.
penagate
Jun 22nd, 2007, 09:57 AM
Threads merged
rocket1356
Jun 22nd, 2007, 12:22 PM
How would I go about setting a listening port on the LINUX server?
Hack
Jun 22nd, 2007, 12:44 PM
Moved to Linux section
sunburnt
Jun 22nd, 2007, 01:30 PM
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:
#!/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)
tr333
Jun 25th, 2007, 11:29 PM
A quick search on Google found this:
Introduction to Visual Basic Socket Programming (http://www.osix.net/modules/article/?id=25)
On the linux side, it all depends what language you're going to use.
vbforums.com
Copyright Internet.com Inc., All Rights Reserved.