@@ -278,7 +278,30 @@ public static void SendByte(Socket socket, byte value)
278
278
}
279
279
280
280
/// <summary>
281
- /// Receives data from a bound <see cref="Socket"/>into a receive buffer.
281
+ /// Receives data from a bound <see cref="Socket"/>.
282
+ /// </summary>
283
+ /// <param name="socket"></param>
284
+ /// <param name="size">The number of bytes to receive.</param>
285
+ /// <param name="timeout">Specifies the amount of time after which the call will time out.</param>
286
+ /// <returns>
287
+ /// The bytes received.
288
+ /// </returns>
289
+ /// <remarks>
290
+ /// If no data is available for reading, the <see cref="Read(Socket, int, TimeSpan)"/> method will
291
+ /// block until data is available or the time-out value is exceeded. If the time-out value is exceeded, the
292
+ /// <see cref="Read(Socket, int, TimeSpan)"/> call will throw a <see cref="SshOperationTimeoutException"/>.
293
+ /// If you are in non-blocking mode, and there is no data available in the in the protocol stack buffer, the
294
+ /// <see cref="Read(Socket, int, TimeSpan)"/> method will complete immediately and throw a <see cref="SocketException"/>.
295
+ /// </remarks>
296
+ public static byte [ ] Read ( Socket socket , int size , TimeSpan timeout )
297
+ {
298
+ var buffer = new byte [ size ] ;
299
+ Read ( socket , buffer , 0 , size , timeout ) ;
300
+ return buffer ;
301
+ }
302
+
303
+ /// <summary>
304
+ /// Receives data from a bound <see cref="Socket"/> into a receive buffer.
282
305
/// </summary>
283
306
/// <param name="socket"></param>
284
307
/// <param name="buffer">An array of type <see cref="byte"/> that is the storage location for the received data. </param>
@@ -289,11 +312,11 @@ public static void SendByte(Socket socket, byte value)
289
312
/// The number of bytes received.
290
313
/// </returns>
291
314
/// <remarks>
292
- /// If no data is available for reading, the <see cref="Read(Socket,byte[], int, int, TimeSpan)"/> method will
293
- /// block until data is available or the time-out value was exceeded. If the time-out value was exceeded, the
294
- /// <see cref="Read(Socket,byte[], int, int, TimeSpan)"/> call will throw a <see cref="SshOperationTimeoutException"/>.
315
+ /// If no data is available for reading, the <see cref="Read(Socket, byte[], int, int, TimeSpan)"/> method will
316
+ /// block until data is available or the time-out value is exceeded. If the time-out value is exceeded, the
317
+ /// <see cref="Read(Socket, byte[], int, int, TimeSpan)"/> call will throw a <see cref="SshOperationTimeoutException"/>.
295
318
/// If you are in non-blocking mode, and there is no data available in the in the protocol stack buffer, the
296
- /// <see cref="Read(Socket,byte[], int, int, TimeSpan)"/> method will complete immediately and throw a <see cref="SocketException"/>.
319
+ /// <see cref="Read(Socket, byte[], int, int, TimeSpan)"/> method will complete immediately and throw a <see cref="SocketException"/>.
297
320
/// </remarks>
298
321
public static int Read ( Socket socket , byte [ ] buffer , int offset , int size , TimeSpan timeout )
299
322
{
0 commit comments