|
-
August 29th, 2001, 09:40 AM
#1
How to connect VB with Unix?
Hello,
Is there a way to connect to Unix using VB. If there is a way, can you use Unix commands and execute them. Can someone send me a small project or code on how to go about doing this.
Thanks,
-
August 29th, 2001, 09:52 AM
#2
Re: How to connect VB with Unix?
you said that you would like to connect to unix using VB code that can be done you should use the winstock control which helps you to connect to the unix port and talk to unix system.
first connect to unix server by typing wistock1.connect
then specify the protocol either tcp/ip e.t.c
then use winstock1.senddata to send the unix command and if taht command returns some value that can be captured by winstock1.getdata commnad
i hopw this will help you as i have done the similar case before.
-
August 29th, 2001, 10:34 AM
#3
Re: How to connect VB with Unix?
Thankyou bhanuprakash!
Is there a small project or code that you might have some where that I can see.
-
August 29th, 2001, 07:34 PM
#4
Re: How to connect VB with Unix?
include a winsock control (winsock1) in your form
private sub Button1_click()
winsock1.connect "myUnixMachine",23
end sub
private sub winsock1_connect()
debug.print "connect to unix system"
'/* now I try a logon
winsock.senddata "myuser" & vbcrlf
winsock.senddata "mypwd" & vbcrlf
end sub
private sub winsock1_dataarrival(byval bytes as long)
dim Unixdata as string
winsock1.getdata unixstring
debug.print unixstring
end sub
private sun winsock1_close()
debug.print "Connection close."
end sub
private sun winsock1_error(...)
debuug.print "error."
end sub
private button2_click()
'/* use to send command to remote machine
winsock1.senddata text1.text & vbcrlf
end sub
private button3_click()
'/* use to close connection
if winsock1.state <> sckclosed then winsock1.close
'or -> winsock1.senddata "quit" & vbcrlf
end sub
hi,brt
<center>
<HR width=80%>
<img src='http://web.tiscali.it/bertaplanet/im...ertaplanet.gif'>
</center>
-
October 10th, 2002, 10:23 PM
#5
urgent
can u all send me the code about how to connect vb to unix server and send the command to unix server.(example: send the command to unix sever which is run pearl script in unix server ) i am urgent to need it and it can help me a lot ....thanx a lot to u all...
-
October 11th, 2002, 01:39 AM
#6
-
October 11th, 2002, 02:27 AM
#7
ok...thanx a lot ....rite now i am using visual basic to design interface and i have to create file in unix and store my data ifrom VB interface into unix. is that possible to do it ? and how can get more inoformation about winsock method.
-
October 11th, 2002, 02:33 AM
#8
...Yes it's possible...
yuo can user unix command using socket...
after yuo have the logon u can use
echo "my data string" >> myfile
..so you can store your data in "myfile" on unix ....
example on socket control? yuo can look on MSDN... there is a good sample of client-server =)
hi
M.rkino
-
October 11th, 2002, 02:46 AM
#9
thanx....ehmmm is there an example or code that you might have some where that I can see.
-
October 13th, 2002, 09:44 PM
#10
urgent...connect unix server
i am not clear with how to typr the unix command in visual basic....so can anyone help me ...and i cannot connect to unix server so can brief me more clearly??thanx a lot..
-
October 13th, 2002, 09:55 PM
#11
Show what you already have, and we'll try to figure out where you're going wrong. Its a little difficult to help, when we can't see where you're up to, and what you're doing wrong.
-
October 13th, 2002, 11:13 PM
#12
because i donno whether i already connect to unix server already or not...how can i know it???this is my code actually i want to view my file which name testing...but i can't get the content of my file.i just the first time use winsock so.....
Option Explicit
Private Sub cmdclose_Click()
Winsock1.Close
End Sub
Private Sub cmdConnect_click()
Winsock1.Connect "unixserver",23
shpGo.Visible = True
End Sub
Private Sub cmdsend_Click()
Winsock1.SendData txtfile.Text & vbCrLf
End Sub
Private Sub Winsock1_Close()
Debug.Print "Connection close."
End Sub
Private Sub winsock1_connect()
Debug.Print "connect to unix server system"
Winsock1.SendData "myuser" & vbCrLf
Winsock1.SendData " mypass" & vbCrLf
Winsock1.SendData "cat testing" & vbCrLf 'i want to view the content of file ( unix command)
shpWait.Visible = True
shpGo.Visible = False
End Sub
'i got error in this part,what shuld i put in my case
Private Sub winsock1_dataarrival(ByVal bytes As Long)
Dim Unixdata As String
Winsock1.GetData unixstring
Debug.Print unixstring
End Sub
Private Sub Winsock1_Error(ByVal Number As Integer, Description As String, ByVal Scode As Long, ByVal Source As String, ByVal HelpFile As String, ByVal HelpContext As Long, CancelDisplay As Boolean)
Debug.Print "error"
End Sub
-
October 14th, 2002, 01:35 AM
#13
Try
Private Sub winsock1_connect()
dim strConnected as string
on error goto errtrap
strConnected = "Connected"
Debug.Print "connect to unix server system"
Winsock1.SendData "myuser" & vbCrLf
Winsock1.SendData " mypass" & vbCrLf
txt1.text = strconnected
Winsock1.SendData "cat testing" & vbCrLf 'i want to view the content of file ( unix command)
shpWait.Visible = True
shpGo.Visible = False
exit sub
ErrTrap:
msgbox "Error Number " & err.number & vbcrlf & _
"Error Description " & err.description
err.clear
End Sub
In your 'dataArrival' sub, you need to get the size of the bytes, then convert the buffer to a string - I used to have some code that did it, but I appear to have lost it over the years. Somebody else here may either have a link to the articles on MSDN, or may have some code taht will help you out for that bit.
-
October 16th, 2002, 12:44 AM
#14
if i run the program then the msg box in vb is prompt out RFB 003.003..what is meaning for??? if i use vnc(virtual network control to connect my unix server ...then how can i send the command in visual basic to the vnc window??? thanx
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
|