mirror of
https://github.com/beefytech/Beef.git
synced 2025-06-12 05:14:10 +02:00
Fix for Socket class on linux.
closesocket() is windows only.
This commit is contained in:
parent
81af04a1ce
commit
9657cdd55b
1 changed files with 14 additions and 2 deletions
|
@ -146,10 +146,13 @@ namespace System.Net
|
||||||
|
|
||||||
[CLink, StdCall]
|
[CLink, StdCall]
|
||||||
internal static extern int32 connect(HSocket s, SockAddr* name, int32 nameLen);
|
internal static extern int32 connect(HSocket s, SockAddr* name, int32 nameLen);
|
||||||
|
#if BF_PLATFORM_WINDOWS
|
||||||
[CLink, StdCall]
|
[CLink, StdCall]
|
||||||
internal static extern int32 closesocket(HSocket s);
|
internal static extern int32 closesocket(HSocket s);
|
||||||
|
#else
|
||||||
|
[CLink, StdCall]
|
||||||
|
internal static extern int32 close(HSocket s);
|
||||||
|
#endif
|
||||||
[CLink, StdCall]
|
[CLink, StdCall]
|
||||||
internal static extern int32 bind(HSocket s, SockAddr* name, int32 nameLen);
|
internal static extern int32 bind(HSocket s, SockAddr* name, int32 nameLen);
|
||||||
|
|
||||||
|
@ -174,7 +177,11 @@ namespace System.Net
|
||||||
public ~this()
|
public ~this()
|
||||||
{
|
{
|
||||||
if (mHandle != INVALID_SOCKET)
|
if (mHandle != INVALID_SOCKET)
|
||||||
|
#if BF_PLATFORM_WINDOWS
|
||||||
closesocket(mHandle);
|
closesocket(mHandle);
|
||||||
|
#else
|
||||||
|
close(mHandle);
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void Init()
|
public static void Init()
|
||||||
|
@ -352,7 +359,11 @@ namespace System.Net
|
||||||
public void Close()
|
public void Close()
|
||||||
{
|
{
|
||||||
mIsConnected = false;
|
mIsConnected = false;
|
||||||
|
#if BF_PLATFORM_WINDOWS
|
||||||
closesocket(mHandle);
|
closesocket(mHandle);
|
||||||
|
#else
|
||||||
|
close(mHandle);
|
||||||
|
#endif
|
||||||
mHandle = INVALID_SOCKET;
|
mHandle = INVALID_SOCKET;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -365,3 +376,4 @@ namespace System.Net
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue