Skip to content

Commit 9be133f

Browse files
committed
build
1 parent d08f979 commit 9be133f

2 files changed

Lines changed: 40 additions & 40 deletions

File tree

source/NetCoreServer/UdpClient.cs

Lines changed: 17 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -303,32 +303,32 @@ public virtual void LeaveMulticastGroup(IPAddress address)
303303
/// Send datagram to the connected server (synchronous)
304304
/// </summary>
305305
/// <param name="buffer">Datagram buffer to send</param>
306-
/// <returns>'true' if the datagram was successfully sent, 'false' if the datagram was not sent</returns>
307-
public virtual bool Send(byte[] buffer) { return Send(buffer, 0, buffer.Length); }
306+
/// <returns>Size of sent datagram</returns>
307+
public virtual long Send(byte[] buffer) { return Send(buffer, 0, buffer.Length); }
308308

309309
/// <summary>
310310
/// Send datagram to the connected server (synchronous)
311311
/// </summary>
312312
/// <param name="buffer">Datagram buffer to send</param>
313313
/// <param name="offset">Datagram buffer offset</param>
314314
/// <param name="size">Datagram buffer size</param>
315-
/// <returns>'true' if the datagram was successfully sent, 'false' if the datagram was not sent</returns>
316-
public virtual bool Send(byte[] buffer, long offset, long size) { return Send(Endpoint, buffer, offset, size); }
315+
/// <returns>Size of sent datagram</returns>
316+
public virtual long Send(byte[] buffer, long offset, long size) { return Send(Endpoint, buffer, offset, size); }
317317

318318
/// <summary>
319319
/// Send text to the connected server (synchronous)
320320
/// </summary>
321321
/// <param name="text">Text string to send</param>
322-
/// <returns>'true' if the text was successfully sent, 'false' if the text was not sent</returns>
323-
public virtual bool Send(string text) { return Send(Encoding.UTF8.GetBytes(text)); }
322+
/// <returns>Size of sent datagram</returns>
323+
public virtual long Send(string text) { return Send(Encoding.UTF8.GetBytes(text)); }
324324

325325
/// <summary>
326326
/// Send datagram to the given endpoint (synchronous)
327327
/// </summary>
328328
/// <param name="endpoint">Endpoint to send</param>
329329
/// <param name="buffer">Datagram buffer to send</param>
330-
/// <returns>'true' if the datagram was successfully sent, 'false' if the datagram was not sent</returns>
331-
public virtual bool Send(EndPoint endpoint, byte[] buffer) { return Send(endpoint, buffer, 0, buffer.Length); }
330+
/// <returns>Size of sent datagram</returns>
331+
public virtual long Send(EndPoint endpoint, byte[] buffer) { return Send(endpoint, buffer, 0, buffer.Length); }
332332

333333
/// <summary>
334334
/// Send datagram to the given endpoint (synchronous)
@@ -337,14 +337,14 @@ public virtual void LeaveMulticastGroup(IPAddress address)
337337
/// <param name="buffer">Datagram buffer to send</param>
338338
/// <param name="offset">Datagram buffer offset</param>
339339
/// <param name="size">Datagram buffer size</param>
340-
/// <returns>'true' if the datagram was successfully sent, 'false' if the datagram was not sent</returns>
341-
public virtual bool Send(EndPoint endpoint, byte[] buffer, long offset, long size)
340+
/// <returns>Size of sent datagram</returns>
341+
public virtual long Send(EndPoint endpoint, byte[] buffer, long offset, long size)
342342
{
343343
if (!IsConnected)
344-
return false;
344+
return 0;
345345

346346
if (size == 0)
347-
return true;
347+
return 0;
348348

349349
try
350350
{
@@ -360,14 +360,14 @@ public virtual bool Send(EndPoint endpoint, byte[] buffer, long offset, long siz
360360
OnSent(endpoint, sent);
361361
}
362362

363-
return true;
363+
return sent;
364364
}
365-
catch (ObjectDisposedException) { return false; }
365+
catch (ObjectDisposedException) { return 0; }
366366
catch (SocketException ex)
367367
{
368368
SendError(ex.SocketErrorCode);
369369
Disconnect();
370-
return false;
370+
return 0;
371371
}
372372
}
373373

@@ -376,8 +376,8 @@ public virtual bool Send(EndPoint endpoint, byte[] buffer, long offset, long siz
376376
/// </summary>
377377
/// <param name="endpoint">Endpoint to send</param>
378378
/// <param name="text">Text string to send</param>
379-
/// <returns>'true' if the text was successfully sent, 'false' if the text was not sent</returns>
380-
public virtual bool Send(EndPoint endpoint, string text) { return Send(endpoint, Encoding.UTF8.GetBytes(text)); }
379+
/// <returns>Size of sent datagram</returns>
380+
public virtual long Send(EndPoint endpoint, string text) { return Send(endpoint, Encoding.UTF8.GetBytes(text)); }
381381

382382
/// <summary>
383383
/// Send datagram to the connected server (asynchronous)

source/NetCoreServer/UdpServer.cs

Lines changed: 23 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -264,24 +264,24 @@ public virtual bool Restart()
264264
/// Multicast datagram to the prepared mulicast endpoint (synchronous)
265265
/// </summary>
266266
/// <param name="buffer">Datagram buffer to multicast</param>
267-
/// <returns>'true' if the datagram was successfully multicasted, 'false' if the datagram was not multicasted</returns>
268-
public virtual bool Multicast(byte[] buffer) { return Multicast(buffer, 0, buffer.Length); }
267+
/// <returns>Size of multicasted datagram</returns>
268+
public virtual long Multicast(byte[] buffer) { return Multicast(buffer, 0, buffer.Length); }
269269

270270
/// <summary>
271271
/// Multicast datagram to the prepared mulicast endpoint (synchronous)
272272
/// </summary>
273273
/// <param name="buffer">Datagram buffer to multicast</param>
274274
/// <param name="offset">Datagram buffer offset</param>
275275
/// <param name="size">Datagram buffer size</param>
276-
/// <returns>'true' if the datagram was successfully multicasted, 'false' if the datagram was not multicasted</returns>
277-
public virtual bool Multicast(byte[] buffer, long offset, long size) { return Send(MulticastEndpoint, buffer, offset, size); }
276+
/// <returns>Size of multicasted datagram</returns>
277+
public virtual long Multicast(byte[] buffer, long offset, long size) { return Send(MulticastEndpoint, buffer, offset, size); }
278278

279279
/// <summary>
280280
/// Multicast text to the prepared mulicast endpoint (synchronous)
281281
/// </summary>
282282
/// <param name="text">Text string to multicast</param>
283-
/// <returns>'true' if the text was successfully multicasted, 'false' if the text was not multicasted</returns>
284-
public virtual bool Multicast(string text) { return Multicast(Encoding.UTF8.GetBytes(text)); }
283+
/// <returns>Size of multicasted datagram</returns>
284+
public virtual long Multicast(string text) { return Multicast(Encoding.UTF8.GetBytes(text)); }
285285

286286
/// <summary>
287287
/// Multicast datagram to the prepared mulicast endpoint (asynchronous)
@@ -310,32 +310,32 @@ public virtual bool Restart()
310310
/// Send datagram to the connected server (synchronous)
311311
/// </summary>
312312
/// <param name="buffer">Datagram buffer to send</param>
313-
/// <returns>'true' if the datagram was successfully sent, 'false' if the datagram was not sent</returns>
314-
public virtual bool Send(byte[] buffer) { return Send(buffer, 0, buffer.Length); }
313+
/// <returns>Size of sent datagram</returns>
314+
public virtual long Send(byte[] buffer) { return Send(buffer, 0, buffer.Length); }
315315

316316
/// <summary>
317317
/// Send datagram to the connected server (synchronous)
318318
/// </summary>
319319
/// <param name="buffer">Datagram buffer to send</param>
320320
/// <param name="offset">Datagram buffer offset</param>
321321
/// <param name="size">Datagram buffer size</param>
322-
/// <returns>'true' if the datagram was successfully sent, 'false' if the datagram was not sent</returns>
323-
public virtual bool Send(byte[] buffer, long offset, long size) { return Send(Endpoint, buffer, offset, size); }
322+
/// <returns>Size of sent datagram</returns>
323+
public virtual long Send(byte[] buffer, long offset, long size) { return Send(Endpoint, buffer, offset, size); }
324324

325325
/// <summary>
326326
/// Send text to the connected server (synchronous)
327327
/// </summary>
328328
/// <param name="text">Text string to send</param>
329-
/// <returns>'true' if the text was successfully sent, 'false' if the text was not sent</returns>
330-
public virtual bool Send(string text) { return Send(Encoding.UTF8.GetBytes(text)); }
329+
/// <returns>Size of sent datagram</returns>
330+
public virtual long Send(string text) { return Send(Encoding.UTF8.GetBytes(text)); }
331331

332332
/// <summary>
333333
/// Send datagram to the given endpoint (synchronous)
334334
/// </summary>
335335
/// <param name="endpoint">Endpoint to send</param>
336336
/// <param name="buffer">Datagram buffer to send</param>
337-
/// <returns>'true' if the datagram was successfully sent, 'false' if the datagram was not sent</returns>
338-
public virtual bool Send(EndPoint endpoint, byte[] buffer) { return Send(endpoint, buffer, 0, buffer.Length); }
337+
/// <returns>Size of sent datagram</returns>
338+
public virtual long Send(EndPoint endpoint, byte[] buffer) { return Send(endpoint, buffer, 0, buffer.Length); }
339339

340340
/// <summary>
341341
/// Send datagram to the given endpoint (synchronous)
@@ -344,14 +344,14 @@ public virtual bool Restart()
344344
/// <param name="buffer">Datagram buffer to send</param>
345345
/// <param name="offset">Datagram buffer offset</param>
346346
/// <param name="size">Datagram buffer size</param>
347-
/// <returns>'true' if the datagram was successfully sent, 'false' if the datagram was not sent</returns>
348-
public virtual bool Send(EndPoint endpoint, byte[] buffer, long offset, long size)
347+
/// <returns>Size of sent datagram</returns>
348+
public virtual long Send(EndPoint endpoint, byte[] buffer, long offset, long size)
349349
{
350350
if (!IsStarted)
351-
return false;
351+
return 0;
352352

353353
if (size == 0)
354-
return true;
354+
return 0;
355355

356356
try
357357
{
@@ -367,13 +367,13 @@ public virtual bool Send(EndPoint endpoint, byte[] buffer, long offset, long siz
367367
OnSent(endpoint, sent);
368368
}
369369

370-
return true;
370+
return sent;
371371
}
372-
catch (ObjectDisposedException) { return false; }
372+
catch (ObjectDisposedException) { return 0; }
373373
catch (SocketException ex)
374374
{
375375
SendError(ex.SocketErrorCode);
376-
return false;
376+
return 0;
377377
}
378378
}
379379

@@ -382,8 +382,8 @@ public virtual bool Send(EndPoint endpoint, byte[] buffer, long offset, long siz
382382
/// </summary>
383383
/// <param name="endpoint">Endpoint to send</param>
384384
/// <param name="text">Text string to send</param>
385-
/// <returns>'true' if the text was successfully sent, 'false' if the text was not sent</returns>
386-
public virtual bool Send(EndPoint endpoint, string text) { return Send(endpoint, Encoding.UTF8.GetBytes(text)); }
385+
/// <returns>Size of sent datagram</returns>
386+
public virtual long Send(EndPoint endpoint, string text) { return Send(endpoint, Encoding.UTF8.GetBytes(text)); }
387387

388388
/// <summary>
389389
/// Send datagram to the given endpoint (asynchronous)

0 commit comments

Comments
 (0)