Skip to content
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

netstandard2.1 DoReceive fails on Zero Length Reads on Mono #70

Open
HelloKitty opened this issue Sep 20, 2022 · 1 comment
Open

netstandard2.1 DoReceive fails on Zero Length Reads on Mono #70

HelloKitty opened this issue Sep 20, 2022 · 1 comment

Comments

@HelloKitty
Copy link

Seems that netstandard2.1 fails to read zero length reads without exception from a combination of the SOCKET_STREAM_BUFFERS path combined with the fact that Mono checks the buffer and bufferlist is non-empty or non-null here: https://github.com/mono/mono/blame/main/mcs/class/System/System.Net.Sockets/Socket.cs#L1508

I don't know why suddenly this issue, after like a year of use, has come up but I guess it can only be because I've updated Unity3D and started targeting netstandard2.1.

I don't have a great solution other than just removing the SOCKET_STREAM_BUFFERS path in SocketConnection.DoRecieve and also setting the null buffer to an empty array with size 1. This solution is probably not ideal so hopefully you'll know what's best to change.

@mgravell
Copy link
Owner

Do you have a scenario in mind where this manifests? This is usually controlled via the SocketConnectionOptions.ZeroLengthReads flag, in which case: don't specify that?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants