public override bool SendTo(byte[] buffer, int bytesToSend, UdpEndPoint endpoint, ref int bytesSent) { fixed(byte *p = buffer) { return(bytesToSend == (bytesSent = UdpNativeInvoke.udpSendTo(ptr, new IntPtr(p), bytesToSend, endpoint))); } }
public override bool RecvFrom(byte[] buffer, int bufferSize, ref int bytesReceived, ref UdpEndPoint remoteEndpoint) { UdpEndPoint nativeEndpoint = default(UdpEndPoint); fixed(byte *p = buffer) { bytesReceived = UdpNativeInvoke.udpRecvFrom(ptr, new IntPtr(p), bufferSize, &nativeEndpoint); } if (bytesReceived > 0) { remoteEndpoint = nativeEndpoint; return(true); } return(false); }
public override bool RecvPoll(int timeoutInMs) { return(UdpNativeInvoke.udpRecvPoll(ptr, timeoutInMs) == UdpNativeInvoke.UDPKIT_SOCKET_OK); }
public override bool Bind(UdpEndPoint endpoint) { return(UdpNativeInvoke.udpBind(ptr, endpoint) == UdpNativeInvoke.UDPKIT_SOCKET_OK); }
public override bool Close() { return(UdpNativeInvoke.udpClose(ptr) == UdpNativeInvoke.UDPKIT_SOCKET_OK); }
UdpPlatformWin32 #endif () { ptr = UdpNativeInvoke.udpCreate(); }