send() private method

private send ( int socket, Array buffer, int length, int flags ) : int
socket int
buffer Array
length int
flags int
return int
コード例 #1
0
ファイル: BluezStream.cs プロジェクト: zipa/wiidevicelibrary
 protected override void Dispose(bool disposing)
 {
     if (_Connected)
     {
         _SendBuffer[0] = 0x15;
         _SendBuffer[1] = 0x1;
         NativeMethods.send(_ControlSocket, _SendBuffer, 2, 0);
         NativeMethods.close(_InterruptSocket);
         NativeMethods.close(_ControlSocket);
     }
     base.Dispose(disposing);
 }
コード例 #2
0
ファイル: BluezStream.cs プロジェクト: zipa/wiidevicelibrary
 public override void Write(byte[] buffer, int offset, int count)
 {
     if (!_Connected)
     {
         throw new IOException("The control socket is not connected");
     }
     _SendBuffer[0] = 0x52;
     Array.Copy(buffer, offset, _SendBuffer, 1, count);
     while (NativeMethods.send(_ControlSocket, _SendBuffer, count + 1, 0) == -1)
     {
         int error = Marshal.GetLastWin32Error();
         if (error != NativeMethods.EINTR)
         {
             NativeMethods.close(_InterruptSocket);
             NativeMethods.close(_ControlSocket);
             _Connected = false;
             throw new IOException("Failed to write to the control socket: " + NativeMethods.strerror(error));
         }
     }
 }