How to communicate with a device (printer or something else) using an ethernet card>

Hi,
I have an instrument that communicate with an ethernet card (using a JAVA applet).  I am not new in VB programming but my experience with Internet/Ethernet communication is limited. The instrument/device response when using IE to commands with the form of "http:\\IP Address\command?"  I would like to use VB to send this command using a http connection and direct the return to a file of some sort. I guess what I am missing is the right control to use! Any advice will be greatly appreciated. Also, please avoid giving answers in terms of link to other pages as I will not bother looking.
Regards.
LVL 1
khaledcAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

DarrenSenior Software EngineerCommented:
Hi,

So the device you wish to communicate with has an IP address. And you send commands to it using http and then get whatever the response is and write it out.

You'll have to change it so that it writes to a file though

Try this from MSDN

Imports System
Imports System.IO
Imports System.Net
Imports System.Text
Namespace Examples.System.Net
    Public Class WebRequestGetExample

        Public Shared Sub Main()
            ' Create a request for the URL.        
            Dim request As WebRequest = WebRequest.Create("http://ipaddress/command?")
            ' Get the response.
            Dim response As HttpWebResponse = CType(request.GetResponse(), HttpWebResponse)
            ' Display the status.
            Console.WriteLine(response.StatusDescription)
            ' Get the stream containing content returned by the server.
            Dim dataStream As Stream = response.GetResponseStream()
            ' Open the stream using a StreamReader for easy access.
            Dim reader As New StreamReader(dataStream)
            ' Read the content.
            Dim responseFromServer As String = reader.ReadToEnd()
            ' Display the content.
            Console.WriteLine(responseFromServer)
            ' Cleanup the streams and the response.
            reader.Close()
            dataStream.Close()
            response.Close()
        End Sub 'Main
    End Class 'WebRequestGetExample
End Namespace

Hope this helps

Darren
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Visual Basic.NET

From novice to tech pro — start learning today.