123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185 |
- using System;
- using System.Net.Sockets;
- using System.Runtime.InteropServices;
- namespace Microsoft.Win32
- {
-
-
-
- public static partial class UnsafeNativeMethods
- {
-
-
-
-
-
-
- [DllImport("ws2_32.dll", SetLastError = true)]
- public static extern SocketError WSAStartup(int wVersionRequested, out NativeMethods.WSADATA lpWSAData);
-
-
-
-
- [DllImport("ws2_32.dll", SetLastError = true)]
- public static extern SocketError WSACleanup();
-
-
-
-
-
-
-
-
-
-
- [DllImport("ws2_32.dll", SetLastError = true)]
- public static extern IntPtr WSASocket(AddressFamily af, SocketType type, ProtocolType protocol, IntPtr lpProtocolInfo, uint g, int dwFlags);
-
-
-
-
-
-
-
-
-
-
-
- [DllImport("ws2_32.dll", SetLastError = true)]
- public static extern SocketError WSASend(IntPtr s, ref NativeMethods.WSABUF lpBuffers, int dwBufferCount, int lpNumberOfBytesSent, ref SocketFlags dwFlags, IntPtr lpOverlapped, IntPtr lpCompletionRoutine);
-
-
-
-
-
-
-
-
-
-
-
- [DllImport("ws2_32.dll", SetLastError = true)]
- public static extern SocketError WSARecv(IntPtr s, ref NativeMethods.WSABUF lpBuffers, int dwBufferCount, out int lpNumberOfBytesRecvd, ref SocketFlags lpFlags, IntPtr lpOverlapped, IntPtr lpCompletionRoutine);
-
-
-
-
-
-
-
-
-
- [DllImport("ws2_32.dll", SetLastError = true)]
- [return: MarshalAs(UnmanagedType.Bool)]
- public static extern bool WSAGetOverlappedResult(IntPtr s, IntPtr lpOverlapped, out int lpcbTransfer, bool fWait, out SocketFlags lpdwFlags);
-
-
-
-
-
-
-
-
-
-
-
-
-
- [DllImport("ws2_32.dll", SetLastError = true)]
- public static extern SocketError WSAIoctl(IntPtr s, int dwIoControlCode, byte[] lpvInBuffer, int cbInBuffer, byte[] lpvOutBuffer, int cbOutBuffer, out int lpcbBytesReturned, IntPtr lpOverlapped, IntPtr lpCompletionRoutine);
-
-
-
-
-
-
-
-
-
-
-
-
-
- [DllImport("Ws2_32.dll", SetLastError = true)]
- public static extern SocketError WSAIoctl(IntPtr s, int dwIoControlCode, ref Guid lpvInBuffer, int cbInBuffer, ref IntPtr lpvOutBuffer, int cbOutBuffer, out int lpcbBytesReturned, IntPtr lpOverlapped, IntPtr lpCompletionRoutine);
-
-
-
-
-
-
-
- [DllImport("ws2_32.dll", SetLastError = true)]
- public static extern SocketError bind(IntPtr s, byte[] name, int namelen);
-
-
-
-
-
-
- [DllImport("ws2_32.dll", SetLastError = true)]
- public static extern SocketError listen(IntPtr s, int backlog);
-
-
-
-
-
- [DllImport("ws2_32.dll", SetLastError = true)]
- public static extern SocketError closesocket(IntPtr s);
-
-
-
-
-
-
-
- [DllImport("ws2_32.dll", SetLastError = true)]
- public static extern SocketError getsockname(IntPtr s, byte[] name, ref int namelen);
-
-
-
-
-
-
-
- [DllImport("ws2_32.dll", SetLastError = true)]
- public static extern SocketError getpeername(IntPtr s, byte[] name, ref int namelen);
-
-
-
-
-
-
-
-
-
- [DllImport("ws2_32.dll", SetLastError = true)]
- public static extern SocketError getsockopt(IntPtr s, int level, int optname, byte[] optval, int optlen);
-
-
-
-
-
-
-
-
-
- [DllImport("ws2_32.dll", SetLastError = true)]
- public static extern SocketError setsockopt(IntPtr s, int level, int optname, byte[] optval, int optlen);
- }
- }
|