Quantcast
Channel: VBForums - Visual Basic .NET
Viewing all articles
Browse latest Browse all 27512

Replace PHP with VB.NET

$
0
0
I'm testing an idea of mine. A web server at a hosting company sends a stream over to a machine which is running Apache + PHP. A very small PHP program receives that input, parses the data and then sends a SUCCESS message back to the web server at the hosting company. I'm wanting to eliminate Apache and the PHP program in favor of a VB.NET program which listens on the desired port for this stream and then sends the SUCCESS message.

I have a small code which listens on the port the Apache server would normally be running on. I can see the stream of data come into it and I capture it in a text box for now. What I want to do is to send the SUCCESS message back to the hosting company's server but I'm not sure how to do that. Here is what I'm using but I guess unlike the PHP program which knows where to send the SUCCESS message, my VB.NET program needs a little more help as to where to send the return message.

Code:

Sub Send2OI()
        Dim strResponse As String = "SUCCESS"
        Dim myRequest As WebRequest = WebRequest.Create(strResponse)
        ' Return the response.
        Dim myResponse As WebResponse = myRequest.GetResponse()
        Dim ResponseText As String
        Dim myStreamReader As StreamReader
        myStreamReader = New StreamReader(myResponse.GetResponseStream())
        ResponseText = myStreamReader.ReadToEnd
        ' Close the response to free resources.     
        myResponse.Close()
    End Sub


Viewing all articles
Browse latest Browse all 27512

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>