Guest User

Untitled

a guest
Apr 20th, 2018
57
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.50 KB | None | 0 0
  1. // serialize the endpoint to a SocketAddress and create an array to hold the values. Pin the array.
  2. SocketAddress socketAddress = ipEndPoint.Serialize();
  3. byte[] socketBytes = new byte[socketAddress.Size];
  4. GCHandle handleSocketAddress = GCHandle.Alloc(socketBytes, GCHandleType.Pinned);
  5.  
  6. // Should copy the first 16 bytes (the SocketAddress has a 32 byte buffer, the size will only be 16, which is what the SOCKADDR accepts
  7. for (int i = 0; i < socketAddress.Size; ++i)
  8. {
  9. socketBytes[i] = socketAddress[i];
  10. }
Add Comment
Please, Sign In to add comment