TcpClientMixins.cs 435 B

12345678910111213141516171819
  1. using System.Net.Sockets;
  2. namespace S7.Net
  3. {
  4. public static class TcpClientMixins
  5. {
  6. #if NETSTANDARD1_3
  7. public static void Close(this TcpClient tcpClient)
  8. {
  9. tcpClient.Dispose();
  10. }
  11. public static void Connect(this TcpClient tcpClient, string host, int port)
  12. {
  13. tcpClient.ConnectAsync(host, port).GetAwaiter().GetResult();
  14. }
  15. #endif
  16. }
  17. }