Код: Выделить всё
Dim request As HttpWebRequest = HttpWebRequest.Create("http://192.178.47.19:19/?r=")
Dim POST As String = "r1"
request.Method = "POST"
request.ContentType = "text/html"
request.Headers.Add("Access-Control-Allow-Origin: *")
request.ContentLength = POST.Length
request.KeepAlive = True
Dim requestStream As Stream = request.GetRequestStream()
Dim postBytes As Byte() = Encoding.ASCII.GetBytes(POST)
requestStream.Write(postBytes, 0, postBytes.Length)
requestStream.Close()
Код: Выделить всё
Dim requestStream As Stream = request.GetRequestStream()
Базовое соединение было закрыто: соединение было закрыто неожиданно.
Использование только jQuery и AJAX:
Код: Выделить всё
jQuery.support.cors = true;
$.ajax({
crossDomain: true,
async : true,
type: "POST",
headers: {'Access-Control-Allow-Origin': '*'},
url: "http://192.178.47.19:19/?r=" + whatsBeingSent,
data: '{}',
contentType: "text/html",
dataType: "html",
success: OnSuccessCallArduino,
error: OnErrorCallArduino
});
Так чего мне не хватает, чтобы он работал в VB.net?
Подробнее здесь: https://stackoverflow.com/questions/224 ... webrequest
Мобильная версия