Start New Discussion within our Software Development Community

Is it possible to make a web request using sockets? I am still studying about socket programming in and i wanted to upgrade my web request code using sockets.

Here is my web request code:

    Dim cweb As String = ""
    Dim POST As String = "sample post data"
    Dim request As HttpWebRequest
    Dim response As HttpWebResponse
    Dim tempCookies As New CookieContainer

        request = CType(WebRequest.Create(cweb), HttpWebRequest)
        request.UserAgent = "Mozilla/5.0 (Windows NT 6.1; WOW64; rv:23.0) Gecko/20100101 Firefox/23.0"
        request.AllowAutoRedirect = True
        request.ContentType = "application/x-www-form-urlencoded"
        request.ContentLength = POST.Length
        request.Method = "POST"
        request.KeepAlive = True
        request.CookieContainer = tempCookies

        Dim requestStream As Stream = request.GetRequestStream()
        Dim postBytes As Byte() = Encoding.ASCII.GetBytes(POST)
        requestStream.Write(postBytes, 0, postBytes.Length)

        response = CType(request.GetResponse(), HttpWebResponse)
        Dim postreader As New StreamReader(response.GetResponseStream())
        Dim thepage As String = postreader.ReadToEnd

Any samples or tips will be gladly accepted i really want to learn making a web request using sockets. Thanks in advance.

yes I have seen that but i have no idea on how to make a post request method using sockets

This article has been dead for over six months. Start a new discussion instead.