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.
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.
Re: How to connect to a LINUX machine using VB6
Re: How to connect to a LINUX machine using VB6
How would I go about setting a listening port on the LINUX server?
Re: How to connect to a LINUX machine using VB6
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)
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.