Skip to content
Permalink
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>
<Product>32feet.NET</Product>
<Version>4.0.1-beta</Version>
<Version>4.0.2</Version>
<RepositoryUrl>https://github.com/inthehand/32feet</RepositoryUrl>
<PackageProjectUrl>https://github.com/inthehand/32feet</PackageProjectUrl>
<PackageLicenseUrl></PackageLicenseUrl>
<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>
<FileVersion>4.0.1.0103</FileVersion>
<FileVersion>4.0.2.0122</FileVersion>
<AssemblyVersion>4.0.0.0</AssemblyVersion>
<AssemblyName>InTheHand.Net.Bluetooth</AssemblyName>
<DebugType>Full</DebugType>
@@ -23,7 +23,7 @@
<PackageLicenseExpression>MIT</PackageLicenseExpression>
<GeneratePackageOnBuild>true</GeneratePackageOnBuild>
<PackageId>InTheHand.Net.Bluetooth</PackageId>
<PackageReleaseNotes>Initial Beta release</PackageReleaseNotes>
<PackageReleaseNotes>Initial release</PackageReleaseNotes>
<PackageIcon>32feet-package-icon.png</PackageIcon>
</PropertyGroup>

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

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

return len;
}
}

public new void Bind(EndPoint localEP)
{
ThrowIfSocketClosed();
@@ -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;

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

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


[DllImport(winsockDll)]
internal static extern int ioctlsocket(int s, int cmd, out int argp);

[DllImport(winsockDll)]
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.