NetworkStream.cs 1.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172
  1. using System;
  2. using System.IO;
  3. namespace SharpCifs.Util.Sharpen
  4. {
  5. public class NetworkStream : Stream
  6. {
  7. SocketEx _socket;
  8. public NetworkStream(SocketEx socket)
  9. {
  10. _socket = socket;
  11. }
  12. public override bool CanRead
  13. {
  14. get { throw new NotImplementedException(); }
  15. }
  16. public override bool CanSeek
  17. {
  18. get { throw new NotImplementedException(); }
  19. }
  20. public override bool CanWrite
  21. {
  22. get { throw new NotImplementedException(); }
  23. }
  24. public override void Flush()
  25. {
  26. // throw new NotImplementedException();
  27. }
  28. public override long Length
  29. {
  30. get { throw new NotImplementedException(); }
  31. }
  32. public override long Position
  33. {
  34. get
  35. {
  36. throw new NotImplementedException();
  37. }
  38. set
  39. {
  40. throw new NotImplementedException();
  41. }
  42. }
  43. public override int Read(byte[] buffer, int offset, int count)
  44. {
  45. return _socket.Receive(buffer, offset, count);
  46. }
  47. public override long Seek(long offset, SeekOrigin origin)
  48. {
  49. throw new NotImplementedException();
  50. }
  51. public override void SetLength(long value)
  52. {
  53. throw new NotImplementedException();
  54. }
  55. public override void Write(byte[] buffer, int offset, int count)
  56. {
  57. _socket.Send(buffer, offset, count);
  58. }
  59. }
  60. }