فهرست منبع

[cs] C# Stream.Read() may give "A non-blocking socket operation could not be completed immediately." when it is eof.
closes #5063

Aleksandr Kuzmenko 5 سال پیش
والد
کامیت
2c9458dd1c
1فایلهای تغییر یافته به همراه5 افزوده شده و 1 حذف شده
  1. 5 1
      std/cs/io/NativeInput.hx

+ 5 - 1
std/cs/io/NativeInput.hx

@@ -53,7 +53,11 @@ class NativeInput extends Input {
 	override public function readBytes(s:Bytes, pos:Int, len:Int):Int {
 		if (pos < 0 || len < 0 || pos + len > s.length)
 			throw Error.OutsideBounds;
-		var ret = stream.Read(s.getData(), pos, len);
+		var ret = 0;
+		var data = s.getData();
+		try {
+			ret = stream.Read(data, pos, len);
+		} catch (e: Dynamic) {}
 		if (ret == 0) {
 			_eof = true;
 			throw new Eof();