ChannelForwardedTcpip.NET40.cs 842 B

12345678910111213141516171819202122232425262728
  1. using System.Net;
  2. using System.Net.Sockets;
  3. namespace Renci.SshNet.Channels
  4. {
  5. /// <summary>
  6. /// Implements "forwarded-tcpip" SSH channel.
  7. /// </summary>
  8. internal partial class ChannelForwardedTcpip
  9. {
  10. partial void OpenSocket(IPEndPoint remoteEndpoint)
  11. {
  12. this._socket = new Socket(remoteEndpoint.AddressFamily, SocketType.Stream, ProtocolType.Tcp);
  13. this._socket.Connect(remoteEndpoint);
  14. this._socket.SetSocketOption(SocketOptionLevel.Tcp, SocketOptionName.NoDelay, 1);
  15. }
  16. partial void InternalSocketReceive(byte[] buffer, ref int read)
  17. {
  18. read = this._socket.Receive(buffer);
  19. }
  20. partial void InternalSocketSend(byte[] data)
  21. {
  22. this._socket.Send(data);
  23. }
  24. }
  25. }