New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Socket SendFile or BeginSendFile Is there a size limit #34540

Closed
SuYiQianYei opened this Issue Jan 11, 2019 · 6 comments

Comments

Projects
None yet
3 participants
@SuYiQianYei
Copy link

SuYiQianYei commented Jan 11, 2019

Win7 3G size file get Exception

@karelz

This comment has been minimized.

Copy link
Member

karelz commented Jan 11, 2019

@SuYiQianYei are you saying that 3GB file will throw exception?
What is the exception? When is it thrown? (right away or at 3GB)
Did you find the exact file size which triggers the exception?

@stephentoub

This comment has been minimized.

Copy link
Member

stephentoub commented Jan 11, 2019

There's no limit enforced by .NET. Any limitation here comes from the underlying OS. e.g. on Windows SendFile is just a thin wrapper for TransmitFile, and according to https://docs.microsoft.com/en-us/windows/desktop/api/mswsock/nf-mswsock-transmitfile, "The maximum number of bytes that can be transmitted using a single call to the TransmitFile function is 2,147,483,646, the maximum value for a 32-bit integer minus 1." It might be possible for SendFile to make multiple TransmitFile calls if it sees the file length is too large.

@SuYiQianYei

This comment has been minimized.

Copy link

SuYiQianYei commented Jan 11, 2019

@stephentoub

This comment has been minimized.

Copy link
Member

stephentoub commented Jan 11, 2019

Right. I was saying someone could investigate changing it to make multiple calls if needed.

@SuYiQianYei

This comment has been minimized.

Copy link

SuYiQianYei commented Jan 11, 2019

@stephentoub @karelz
I got it Thank you

@karelz karelz removed the needs more info label Jan 11, 2019

@karelz

This comment has been minimized.

Copy link
Member

karelz commented Jan 11, 2019

I will close it as answered. I don't think making multiple TransmitFile calls is necessary. We can reconsider in future if there is higher demand.
@stephentoub feel free to reopen if you disagree ...

@karelz karelz closed this Jan 11, 2019

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment