mirror of
https://github.com/beefytech/Beef.git
synced 2025-06-23 18:18:00 +02:00
Merge pull request #70 from subramanivmk/close_socket_linux
Fix for Socket class on linux.
This commit is contained in:
commit
611ab328d2
1 changed files with 15 additions and 1 deletions
|
@ -146,9 +146,14 @@ namespace System.Net
|
||||||
|
|
||||||
[CLink, StdCall]
|
[CLink, StdCall]
|
||||||
static extern int32 connect(HSocket s, SockAddr* name, int32 nameLen);
|
static extern int32 connect(HSocket s, SockAddr* name, int32 nameLen);
|
||||||
|
|
||||||
|
#if BF_PLATFORM_WINDOWS
|
||||||
[CLink, StdCall]
|
[CLink, StdCall]
|
||||||
static extern int32 closesocket(HSocket s);
|
static extern int32 closesocket(HSocket s);
|
||||||
|
#else
|
||||||
|
[CLink, StdCall]
|
||||||
|
static extern int32 close(HSocket s);
|
||||||
|
#endif
|
||||||
|
|
||||||
[CLink, StdCall]
|
[CLink, StdCall]
|
||||||
static extern int32 bind(HSocket s, SockAddr* name, int32 nameLen);
|
static extern int32 bind(HSocket s, SockAddr* name, int32 nameLen);
|
||||||
|
@ -174,7 +179,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 +361,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 +378,4 @@ namespace System.Net
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue