Skip to content
Browse files

Added missing Available property

  • Loading branch information
peterfoot committed Jan 22, 2020
1 parent 0e6c4c3 commit e67e4c45c54b9947556e1ba2fa0232aaf2a276d9
@@ -5,13 +5,13 @@
<Company>In The Hand Ltd</Company>
<Authors>Peter Foot</Authors>
<Copyright>Copyright (c) 2004-2020 In The Hand Ltd</Copyright>
<Description>32feet.NET is a shared-source project to make personal area networking technologies such as Bluetooth easily accessible from .NET code.</Description>
@@ -23,7 +23,7 @@
<PackageReleaseNotes>Initial Beta release</PackageReleaseNotes>
<PackageReleaseNotes>Initial release</PackageReleaseNotes>

@@ -58,6 +58,18 @@ public new Socket Accept()
return new Win32Socket(newSocket);

public new int Available
int len;
int result = NativeMethods.ioctlsocket(_socket, NativeMethods.FIONREAD, out len);
ThrowOnSocketError(result, true);

return len;

public new void Bind(EndPoint localEP)
@@ -272,6 +284,7 @@ protected override void Dispose(bool disposing)
private static class NativeMethods
private const string winsockDll = "ws2_32.dll";
internal const int FIONREAD = 0x4004667F;

#pragma warning disable IDE1006 // Naming Styles - these are Win32 function names
@@ -300,7 +313,9 @@ private static class NativeMethods

internal static extern int getpeername(int s, byte[] addr, ref int addrlen);

internal static extern int ioctlsocket(int s, int cmd, out int argp);

internal static extern int setsockopt(int s, int level, int optname, byte[] optval, int optlen);

0 comments on commit e67e4c4

Please sign in to comment.
You can’t perform that action at this time.