Connecting to remote Unix box using VB
Messages   Related Types
This message was discovered on ASPFriends.com 'ngfx-remoting' list.


Mallya, Deepak non Unisys
Guys -

Does anyone have an idea as to how I would be able to connect to a remote
Unix Solaris (and also IBM OS390 MVS) box, execute some scripts (JCL on
OS390) using VB com or .net component and the results back to my VB
Application.

Please let me know of any ideas or thoughts that you may have.
Code examples or technical articles on net will be extremely helpful as I am
a novice.

Thanks and expecting some ideas.

Regards
Deepak
Reply to this message...
 
    
Peter Brunone
Deepak,

I know that there are some telnet components out there like IPWorks from
www.nsoftware.com ; another approach might be to use either the command
stored proc in SQL Server or a telnet from a command-line COM object like
one of these: http://aspdll.com/category.asp?id=15 .

A more .NET-oriented way would be to write your own object with the
System.Net.Sockets namespace (some introductory material at
http://www.aspalliance.com/chrisg/default.asp?article=92 , or to use
/nsoftware's new IPWorks.NET, which you can find at
http://www.nsoftware.com/products.asp?part=IPN5-A . I'm not sure of the
licensing fee for this one, but there's a Trial and Full version; you can
get more information from the vendor.

Hope this helps...

Peter
-----Original Message-----
From: Mallya, Deepak non Unisys [mailto:Click here to reveal e-mail address]
Sent: Thursday, April 25, 2002 2:13 PM
To: ngfx-remoting
Subject: [ngfx-remoting] Connecting to remote Unix box using VB

Guys -

Does anyone have an idea as to how I would be able to connect to a remote
Unix Solaris (and also IBM OS390 MVS) box, execute some scripts (JCL on
OS390) using VB com or .net component and the results back to my VB
Application.

Please let me know of any ideas or thoughts that you may have.

Code examples or technical articles on net will be extremely helpful as I
am a novice.

Thanks and expecting some ideas.

Regards

Deepak

| [ngfx-remoting] member Click here to reveal e-mail address = YOUR ID |
http://www.aspfriends.com/aspfriends/ngfx-remoting.asp = JOIN/QUIT
Reply to this message...
 
    
Mallya, Deepak non Unisys
How do I something like this :

The Rshell component is used to execute commands on a remote Unix machine
using the rshell mechanism.
The Rexec component is used to execute commands on a remote UNIX machine
using the rexec mechanism.

Please suggest.

The Code that I managed to put till now looks like this.

Dim Telnet As TcpClient = New TcpClient()
Telnet.Connect("mc", 23)
Dim TelnetStream As NetworkStream = Telnet.GetStream()

If TelnetStream.CanRead And TelnetStream.CanWrite Then
MsgBox("Read and Write")
' Does a simple write.
Dim sendBytes As [Byte]() = Encoding.ASCII.GetBytes("Is anybody
there")
TelnetStream.Write(sendBytes, 0, sendBytes.Length)

' Reads the NetworkStream into a byte buffer.
Dim bytes(Telnet.ReceiveBufferSize) As Byte
TelnetStream.Read(bytes, 0, CInt(Telnet.ReceiveBufferSize))

' Returns the data received from the host to the console.
Dim returndata As String = Encoding.ASCII.GetString(bytes)
MsgBox(("This is what the host returned to you: " + returndata))

End If
If TelnetStream.CanWrite Then
MsgBox("Write")
End If
If TelnetStream.CanRead Then
MsgBox("Read")
End If
Telnet.Close()

Regards
Deepak

-----Original Message-----
From: Peter Brunone [mailto:Click here to reveal e-mail address]
Sent: Thursday, April 25, 2002 5:59 PM
To: ngfx-remoting
Subject: [ngfx-remoting] RE: Connecting to remote Unix box using VB

Deepak,

I know that there are some telnet components out there like IPWorks from
www.nsoftware.com <http://www.nsoftware.com> ; another approach might be to
use either the command stored proc in SQL Server or a telnet from a
command-line COM object like one of these:
http://aspdll.com/category.asp?id=15 <http://aspdll.com/category.asp?id=15>
.

A more .NET-oriented way would be to write your own object with the
System.Net.Sockets namespace (some introductory material at
http://www.aspalliance.com/chrisg/default.asp?article=92
<http://www.aspalliance.com/chrisg/default.asp?article=92> , or to use
/nsoftware's new IPWorks.NET, which you can find at
http://www.nsoftware.com/products.asp?part=IPN5-A
<http://www.nsoftware.com/products.asp?part=IPN5-A>
<http://asp.net/ControlGallery/ControlDetail.aspx?Control=232&tabindex=2> .
I'm not sure of the licensing fee for this one, but there's a Trial and Full
version; you can get more information from the vendor.

Hope this helps...

Peter
-----Original Message-----
From: Mallya, Deepak non Unisys [mailto:Click here to reveal e-mail address]
Sent: Thursday, April 25, 2002 2:13 PM
To: ngfx-remoting
Subject: [ngfx-remoting] Connecting to remote Unix box using VB
Guys -

Does anyone have an idea as to how I would be able to connect to a remote
Unix Solaris (and also IBM OS390 MVS) box, execute some scripts (JCL on
OS390) using VB com or .net component and the results back to my VB
Application.

Please let me know of any ideas or thoughts that you may have.
Code examples or technical articles on net will be extremely helpful as I am
a novice.

Thanks and expecting some ideas.

Regards
Deepak
| [ngfx-remoting] member Click here to reveal e-mail address = YOUR ID |
http://www.aspfriends.com/aspfriends/ngfx-remoting.asp = JOIN/QUIT
| [ngfx-remoting] member Click here to reveal e-mail address = YOUR ID |
http://www.aspfriends.com/aspfriends/ngfx-remoting.asp = JOIN/QUIT
Reply to this message...
 
    
Peter Brunone
Does this code work? I'm behind a firewall without an available telnet
server.

Assuming your telnet stream can write, you would just send the commands
you want, and read the resulting output from the stream. I'm not much of a
Unix buff -- and it's not really on topic here -- so you'd probably have to
get command information from your system's man pages or another list.

-----Original Message-----
From: Mallya, Deepak non Unisys [mailto:Click here to reveal e-mail address]
Sent: Friday, April 26, 2002 8:44 AM
To: ngfx-remoting
Subject: [ngfx-remoting] RE: Connecting to remote Unix box using VB

How do I something like this :

The Rshell component is used to execute commands on a remote Unix machine
using the rshell mechanism.

The Rexec component is used to execute commands on a remote UNIX machine
using the rexec mechanism.

Please suggest.

The Code that I managed to put till now looks like this.

Dim Telnet As TcpClient = New TcpClient()

Telnet.Connect("mc", 23)

Dim TelnetStream As NetworkStream = Telnet.GetStream()

If TelnetStream.CanRead And TelnetStream.CanWrite Then

MsgBox("Read and Write")

' Does a simple write.

Dim sendBytes As [Byte]() = Encoding.ASCII.GetBytes("Is
anybody there")

TelnetStream.Write(sendBytes, 0, sendBytes.Length)

' Reads the NetworkStream into a byte buffer.

Dim bytes(Telnet.ReceiveBufferSize) As Byte

TelnetStream.Read(bytes, 0, CInt(Telnet.ReceiveBufferSize))

' Returns the data received from the host to the console.

Dim returndata As String = Encoding.ASCII.GetString(bytes)

MsgBox(("This is what the host returned to you: " +
returndata))

End If

If TelnetStream.CanWrite Then

MsgBox("Write")

End If

If TelnetStream.CanRead Then

MsgBox("Read")

End If

Telnet.Close()

Regards

Deepak

-----Original Message-----
From: Peter Brunone [mailto:Click here to reveal e-mail address]
Sent: Thursday, April 25, 2002 5:59 PM
To: ngfx-remoting
Subject: [ngfx-remoting] RE: Connecting to remote Unix box using VB

Deepak,

I know that there are some telnet components out there like IPWorks
from www.nsoftware.com ; another approach might be to use either the command
stored proc in SQL Server or a telnet from a command-line COM object like
one of these: http://aspdll.com/category.asp?id=15 .

A more .NET-oriented way would be to write your own object with the
System.Net.Sockets namespace (some introductory material at
http://www.aspalliance.com/chrisg/default.asp?article=92 , or to use
/nsoftware's new IPWorks.NET, which you can find at
http://www.nsoftware.com/products.asp?part=IPN5-A . I'm not sure of the
licensing fee for this one, but there's a Trial and Full version; you can
get more information from the vendor.

Hope this helps...

Peter

-----Original Message-----
From: Mallya, Deepak non Unisys [mailto:Click here to reveal e-mail address]
Sent: Thursday, April 25, 2002 2:13 PM
To: ngfx-remoting
Subject: [ngfx-remoting] Connecting to remote Unix box using VB

Guys -

Does anyone have an idea as to how I would be able to connect to a
remote Unix Solaris (and also IBM OS390 MVS) box, execute some scripts (JCL
on OS390) using VB com or .net component and the results back to my VB
Application.

Please let me know of any ideas or thoughts that you may have.

Code examples or technical articles on net will be extremely helpful as
I am a novice.

Thanks and expecting some ideas.

Regards

Deepak

| [ngfx-remoting] member Click here to reveal e-mail address = YOUR ID |
http://www.aspfriends.com/aspfriends/ngfx-remoting.asp = JOIN/QUIT

| [ngfx-remoting] member Click here to reveal e-mail address = YOUR ID |
http://www.aspfriends.com/aspfriends/ngfx-remoting.asp = JOIN/QUIT

| [ngfx-remoting] member Click here to reveal e-mail address = YOUR ID |
http://www.aspfriends.com/aspfriends/ngfx-remoting.asp = JOIN/QUIT
Reply to this message...
 
    
Digital Convict
If it's a telnet component you're looking for, you could try:

http://www.whisperstream.com/software/commlib/

I dunno if they have any other components, but the telnet one they have is okay and seems to be free and not expire (always a bonus).
Reply to this message...
 
 
System.Net.Sockets.NetworkStream
System.Net.Sockets.TcpClient
System.Text.Encoding




Ad
MBR BootFX
Best-of-breed application framework for .NET projects, developed by Matthew Baxter-Reynolds and MBR IT
 
 Copyright © Matthew Baxter-Reynolds 2001-2008. '.NET 247 Software Development Services' is a trading style of MBR IT Solutions Ltd.
Contact Us - Terms of Use - Privacy Policy - www.dotnet247.com