ws2interop.cs
来自「通过手机蓝牙控制个人电脑上的幻灯片的播放」· CS 代码 · 共 50 行
CS
50 行
#region Using directives
using System;
using System.Text;
using System.Runtime.InteropServices;
using System.Collections;
#endregion
namespace BTHWrapper
{
/// <summary>
/// Summary description for Ws2Interop.
/// </summary>
public class Ws2Interop
{
[DllImport("bthutil", SetLastError = true)]
public extern static Int32 BthSetMode(int dwMode);
[DllImport("bthutil", SetLastError = true)]
public extern static Int32 BthGetMode(IntPtr pdwMode);
[DllImport("Ws2_32", SetLastError = true, EntryPoint = "WSAStartup",CharSet = CharSet.Auto)]
public extern static Int32 WSAStartup([In] short wVersionRequested, [Out] out Ws2Structs.WSAData wsaData);
[DllImport("Ws2", SetLastError = true)]
public extern static Int32 WSACleanup();
[DllImport("ws2", SetLastError = true)]
public extern static IntPtr socket(int family, int type, int protocol);
[DllImport("Ws2", SetLastError = true)]
public extern static int shutdown(IntPtr socket,int how);
[DllImport("Ws2", SetLastError = true)]
public extern static int closesocket(IntPtr socket);
[DllImport("Ws2", SetLastError = true)]
public extern static int connect(IntPtr socket, ref Ws2Structs.SOCKADDR_BTH address, int addressSize);
[DllImport("Ws2", SetLastError = true)]
public extern static int send(IntPtr socket, byte[] buffer, int len, int flags);
[DllImport("Ws2", SetLastError = true)]
public extern static int recv(IntPtr socket, byte[] buffer, int len, int flags);
[DllImport("Ws2", SetLastError = true)]
public extern static int WSAGetLastError();
}
}
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?