Click here to Skip to main content
Rate this: bad
good
Please Sign up or sign in to vote.
See more: C# C#4.0
Hi everybody, I have write a program send and recieve a large file , now it can transfer a file size 1.5G but when I choose large file about 2G it fail and notify:
 
http://i1055.photobucket.com/albums/s505/vn_photo/Untitled-27_zpscf61b7a1.jpg[^]
 
Here is Project:
 
http://www.mediafire.com/?p9b2xj2970d7cqb
 
Please read and help me, it code is short, no long, I need a help I'm nearing to send it for my teacher, I hope everyone will help me.
Posted 16-Dec-12 21:48pm
Comments
jibesh at 17-Dec-12 3:56am
   
for your kind attention CP member normally dont download files from websites unknown to them. If you want a better answer paste the code snippet where you are getting error here. we have better editor here so that you can format the look and feel of the code for better understanding to the other member of this forum.
Rate this: bad
good
Please Sign up or sign in to vote.

Solution 2

In future, copy and paste the error message instead of saving it as a bit map - it's a lot easier and doesn't waste our time so much.
And show your relevant code - don't expect me to go to your site and download an unknown project form an unknown person and load it on my system - because I won't. I have no idea what it does, and I'm not risking it getting run on my system.
 
So, without looking at your code, it's pretty obvious: you are using an int - which is an int32 - which is a signed varaiable that can hold values from -2147483648 to 2147483647 - so when you try to load a value larger than 2Gb - 1 into it, it overflows and you get an error. Use long instead.
  Permalink  
Rate this: bad
good
Please Sign up or sign in to vote.

Solution 7

Hi a fix it as below.
private void OnUpdatepgdstatus(long s, long p)
{
    progressbar.Maximum = Convert.ToInt32(s);
    progressbar.Value = Convert.ToInt32(p);
}
 
So when I choose fie *iso about 2.5G it still fail ? if i replace to ToInt64 it not appropriate
  Permalink  
Rate this: bad
good
Please Sign up or sign in to vote.

Solution 1

Hi,
 
You'll be doing a Convert.ToInt32(something) on line 84 in your server project.
 
The information your trying to convert is too large to hold in the int so change your variable type to hold something larger.
  Permalink  
Rate this: bad
good
Please Sign up or sign in to vote.

Solution 3

I could not go through your code. But from the error message it is clear some value is exceeding the value of an integer.
Debug and then see where exactly you are getting the exception.
Change the datatype of that variable to long and your code should work.
  Permalink  
Rate this: bad
good
Please Sign up or sign in to vote.

Solution 4

Int32 is limited to values between -2^31 and 2^31-1: -2147483648 to 2147483647.
2G is 2^31 and it cannot be stored in an Int32.
You may use an UInt32 (unsigned int)( values between 0 and 4294967295 = 4G-1) or an Int64.
  Permalink  

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
0 OriginalGriff 490
1 Gihan Liyanage 338
2 ChauhanAjay 180
3 Vinay Mistry 160
4 Sergey Alexandrovich Kryukov 153
0 Sergey Alexandrovich Kryukov 9,011
1 OriginalGriff 7,941
2 CPallini 2,603
3 Richard MacCutchan 2,121
4 Abhinav S 1,928


Advertise | Privacy | Mobile
Web04 | 2.8.140827.1 | Last Updated 18 Dec 2012
Copyright © CodeProject, 1999-2014
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100