Main Site Documentation

Send POST request Netmf 4.3


#1

Hello, I’ve got problem sending a post request with sdk 4.3.
I used the code for the 4.2 (working), is there a fix or another way to do it? Thanks
10050 should be connection down, but I tested the network code separately and it works and the exception raises up after the reqData.SendRequest().

POSTContent postData = POSTContent.CreateBinaryBasedContent(picture.PictureData); HttpRequest reqData = HttpHelper.CreateHttpPostRequest("http://192.168.43.206/takephoto/index.php", postData, "image/bmp"); reqData.ResponseReceived += new HttpRequest.ResponseHandler(reqData_ResponseReceived); reqData.SendRequest();

#### Exception System.Net.Sockets.SocketException - CLR_E_FAIL (10) ####
#### Message: 
#### Microsoft.SPOT.Net.SocketNative::poll [IP: 0000] ####
#### System.Net.Sockets.Socket::Poll [IP: 0011] ####
#### System.Net.Sockets.Socket::Connect [IP: 0029] ####
#### System.Net.HttpWebRequest::SubmitRequest [IP: 0019] ####
#### System.Net.HttpWebRequest::GetRequestStream [IP: 0008] ####
#### SocketException ErrorCode = 10050

A first chance exception of type ‘System.Net.Sockets.SocketException’ occurred in Microsoft.SPOT.Net.dll
#### SocketException ErrorCode = 10050
#### SocketException ErrorCode = 10050
#### SocketException ErrorCode = 10050
#### Exception System.Net.WebException - 0x00000000 (10) ####
#### Message: connection failed
#### System.Net.HttpWebRequest::EstablishConnection [IP: 0172] ####
#### System.Net.HttpWebRequest::SubmitRequest [IP: 0019] ####
#### System.Net.HttpWebRequest::GetRequestStream [IP: 0008] ####
A first chance exception of type ‘System.Net.WebException’ occurred in System.Http.dll
A first chance exception of type ‘System.Net.WebException’ occurred in System.Http.dll

An exception occured while connecting to the Internet. Please, make sure that a valid URL is used and a network connection is up.

connection failed
The thread ‘’ (0xa) has exited with code 0 (0x0).
The program ‘[2] Micro Framework application: Managed’ has exited with code 0 (0x0).


#2

this error code is typically the network is down - meaning you don’t have a network context that is active at the time you’re trying to do what you are doing. So it’s unlikely any issue will be in the code you show, but in the leadup code. I’d suggest you create the minimal repro example of this so that someone else could test your code as-is


#3

Thank you, I isolated the code and found the problem: the link pointed to a wrong folder.
So this code works also on 4.3, I confirm