Ethernet ENC28 and netmf 4.3

Hello
I have a raptor main board with Ethernet ENC28 and sd card.
simply, I want to send a large size file from SD to my webserver. I devide my file to 500Kb byte arrays and send each of them to my webserver. then I append received byte arrays to a file.
so far, I used netmf 4.2 and following code was working correctly :


    FileStream fileStream = new FileStream(FilePath, FileMode.Open, FileAccess.Read);
                            long TotalPackages = fileStream.Length / 500000;
      if (TotalPackages > 0)
                            {
                               try
                                {
                                    for (int j = 0; j < TotalPackages; j++)
                                    {
                                        byte[] FileData = new byte[PackageLength];
                                        fileStream.Read(FileData, 0, PackageLength);
                                        WebRequest request = WebRequest.Create("http://172.16.50.43:42124/API.aspx?Type=File");
                                        request.Method = "POST";
                                        request.ContentType = "multipart/form-data";
                                        request.ContentLength = FileData.Length;
                                       request.Headers.Add("FileName", FileName);
                                        Stream dataStream = request.GetRequestStream();
                                        dataStream.Write(FileData, 0, FileData.Length);
                                        dataStream.Close();
                                        WebResponse response = request.GetResponse();
                                        result = ((HttpWebResponse)response).Headers["res"];
                                        if (result == null)
                                        {
                                          return false;
                                        }
                                         // Get the stream containing content returned by the server.
                                        dataStream = response.GetResponseStream();
                                        StreamReader reader = new StreamReader(dataStream);
                                        string responseFromServer = reader.ReadToEnd();
                                        reader.Close();
                                        dataStream.Close();
                                        response.Close();
                                    }
  if (result == "true")
                                      {
                                          return true;
                                        }
                                }
                                catch (Exception e)
                                {
                                    return false;
                                }

but now, I’m using netmf 4.3 and when program reachs to this line for first time :


  dataStream.Write(FileData, 0, FileData.Length);                              

I receive error about socket exception…
Can everybody help me?
thanks

@ andre.m -
I found that I can only send small text file (few Kilo bytes)
it is my e.stackTrace :

try to use ~ 45K for each block

@ Dat -
yes it works…
but in case of netmf 4.2 I could send even 500kb !!!

That because MS added a small code to check the total size in 4.3 while 4.2 doesn’t. We will go deeper later but now that is workaround.

and just so you are crystal clear on what Dat was suggesting… use 45k in this line: