8000 .NET binding: Socket.Send behavior is unexpected · Issue #257 · zerotier/libzt · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content
.NET binding: Socket.Send behavior is unexpected #257
Open
@CCRcmcpe

Description

@CCRcmcpe

public Int32 Send(Byte[] buffer)
{
return Send(buffer, 0, buffer != null ? buffer.Length : 0, SocketFlags.None);
}
public Int32 Send(Byte[] buffer, int offset, int size, SocketFlags socketFlags)
{
if (_isClosed) {
throw new ObjectDisposedException("Socket has been closed");
}
if (_fd < 0) {
throw new ZeroTier.Sockets.SocketException((int)ZeroTier.Constants.ERR_SOCKET);
}
if (buffer == null) {
throw new ArgumentNullException("buffer");
}
if (size < 0 || size > buffer.Length - offset) {
throw new ArgumentOutOfRangeException("size");
}
if (offset < 0 || offset > buffer.Length) {
throw new ArgumentOutOfRangeException("offset");
}
int flags = 0;
IntPtr bufferPtr = Marshal.UnsafeAddrOfPinnedArrayElement(buffer, 0);
return zts_bsd_send(_fd, bufferPtr + offset, (uint)Buffer.ByteLength(buffer), (int)flags);
}

size parameter is just... ignored. Sure this would not be surprising.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      0