1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
|
// **********************************************************************
//
// Copyright (c) 2003-2010 ZeroC, Inc. All rights reserved.
//
// This copy of Ice is licensed to you under the terms described in the
// ICE_LICENSE file included in this distribution.
//
// **********************************************************************
//
// The following is required for the Vista PSDK to bring in
// the definitions of the IN6_IS_ADDR_* macros.
//
#if defined(_WIN32) && !defined(_WIN32_WINNT)
# define _WIN32_WINNT 0x0501
#endif
#include <Ice/UdpTransceiver.h>
#include <Ice/Connection.h>
#include <Ice/Instance.h>
#include <Ice/TraceLevels.h>
#include <Ice/LoggerUtil.h>
#include <Ice/Stats.h>
#include <Ice/Buffer.h>
#include <Ice/Network.h>
#include <Ice/LocalException.h>
#include <Ice/Properties.h>
#include <IceUtil/StringUtil.h>
using namespace std;
using namespace Ice;
using namespace IceInternal;
NativeInfoPtr
IceInternal::UdpTransceiver::getNativeInfo()
{
return this;
}
#if defined(ICE_USE_IOCP)
AsyncInfo*
IceInternal::UdpTransceiver::getAsyncInfo(SocketOperation status)
{
switch(status)
{
case SocketOperationRead:
return &_read;
case SocketOperationWrite:
return &_write;
default:
assert(false);
return 0;
}
}
#endif
SocketOperation
IceInternal::UdpTransceiver::initialize()
{
if(_state == StateNeedConnect)
{
_state = StateConnectPending;
return SocketOperationConnect;
}
else if(_state <= StateConnectPending)
{
try
{
doFinishConnect(_fd);
_state = StateConnected;
}
catch(const Ice::LocalException& ex)
{
if(_traceLevels->network >= 2)
{
Trace out(_logger, _traceLevels->networkCat);
out << "failed to connect udp socket\n" << toString() << "\n" << ex;
}
throw;
}
}
if(_state == StateConnected)
{
if(_traceLevels->network >= 1)
{
Trace out(_logger, _traceLevels->networkCat);
out << "starting to send udp packets\n" << toString();
}
}
assert(_state >= StateConnected);
return SocketOperationNone;
}
void
IceInternal::UdpTransceiver::close()
{
if(_state >= StateConnected && _traceLevels->network >= 1)
{
Trace out(_logger, _traceLevels->networkCat);
out << "closing udp connection\n" << toString();
}
assert(_fd != INVALID_SOCKET);
closeSocket(_fd);
_fd = INVALID_SOCKET;
}
bool
IceInternal::UdpTransceiver::write(Buffer& buf)
{
assert(buf.i == buf.b.begin());
assert(_fd != INVALID_SOCKET && _state >= StateConnected);
// The caller is supposed to check the send size before by calling checkSendSize
assert(min(_maxPacketSize, _sndSize - _udpOverhead) >= static_cast<int>(buf.b.size()));
repeat:
ssize_t ret;
if(_state == StateConnected)
{
#ifdef _WIN32
ret = ::send(_fd, reinterpret_cast<const char*>(&buf.b[0]), static_cast<int>(buf.b.size()), 0);
#else
ret = ::send(_fd, reinterpret_cast<const char*>(&buf.b[0]), buf.b.size(), 0);
#endif
}
else
{
socklen_t len = static_cast<socklen_t>(sizeof(_peerAddr));
if(_peerAddr.ss_family == AF_INET)
{
len = sizeof(sockaddr_in);
}
else if(_peerAddr.ss_family == AF_INET6)
{
len = sizeof(sockaddr_in6);
}
else
{
// No peer has sent a datagram yet.
SocketException ex(__FILE__, __LINE__);
ex.error = 0;
throw ex;
}
#ifdef _WIN32
ret = ::sendto(_fd, reinterpret_cast<const char*>(&buf.b[0]), static_cast<int>(buf.b.size()), 0,
reinterpret_cast<struct sockaddr*>(&_peerAddr), len);
#else
ret = ::sendto(_fd, reinterpret_cast<const char*>(&buf.b[0]), buf.b.size(), 0,
reinterpret_cast<struct sockaddr*>(&_peerAddr), len);
#endif
}
if(ret == SOCKET_ERROR)
{
if(interrupted())
{
goto repeat;
}
if(wouldBlock())
{
return false;
}
SocketException ex(__FILE__, __LINE__);
ex.error = getSocketErrno();
throw ex;
}
if(_traceLevels->network >= 3)
{
Trace out(_logger, _traceLevels->networkCat);
out << "sent " << ret << " bytes via udp\n" << toString();
}
if(_stats)
{
_stats->bytesSent(type(), static_cast<Int>(ret));
}
assert(ret == static_cast<ssize_t>(buf.b.size()));
buf.i = buf.b.end();
return true;
}
bool
IceInternal::UdpTransceiver::read(Buffer& buf)
{
assert(buf.i == buf.b.begin());
assert(_fd != INVALID_SOCKET);
const int packetSize = min(_maxPacketSize, _rcvSize - _udpOverhead);
buf.b.resize(packetSize);
buf.i = buf.b.begin();
repeat:
ssize_t ret;
if(_state == StateConnected)
{
ret = ::recv(_fd, reinterpret_cast<char*>(&buf.b[0]), packetSize, 0);
}
else
{
assert(_incoming);
sockaddr_storage peerAddr;
memset(&peerAddr, 0, sizeof(struct sockaddr_storage));
socklen_t len = static_cast<socklen_t>(sizeof(peerAddr));
ret = recvfrom(_fd, reinterpret_cast<char*>(&buf.b[0]), packetSize, 0,
reinterpret_cast<struct sockaddr*>(&peerAddr), &len);
if(ret != SOCKET_ERROR)
{
_peerAddr = peerAddr;
}
}
if(ret == SOCKET_ERROR)
{
if(recvTruncated())
{
// The message was truncated and the whole buffer is filled. We ignore
// this error here, it will be detected at the connection level when
// the Ice message size is checked against the buffer size.
ret = static_cast<ssize_t>(buf.b.size());
}
else
{
if(interrupted())
{
goto repeat;
}
if(wouldBlock())
{
return false;
}
if(connectionLost())
{
ConnectionLostException ex(__FILE__, __LINE__);
ex.error = getSocketErrno();
throw ex;
}
else
{
SocketException ex(__FILE__, __LINE__);
ex.error = getSocketErrno();
throw ex;
}
}
}
if(_state == StateNeedConnect)
{
//
// If we must connect, we connect to the first peer that sends us a packet.
//
assert(_incoming); // Client connections should always be connected at this point.
#ifndef NDEBUG
bool connected = doConnect(_fd, _peerAddr);
assert(connected);
#else
doConnect(_fd, _peerAddr);
#endif
_state = StateConnected;
if(_traceLevels->network >= 1)
{
Trace out(_logger, _traceLevels->networkCat);
out << "connected udp socket\n" << toString();
}
}
if(_traceLevels->network >= 3)
{
Trace out(_logger, _traceLevels->networkCat);
out << "received " << ret << " bytes via udp\n" << toString();
}
if(_stats)
{
_stats->bytesReceived(type(), static_cast<Int>(ret));
}
buf.b.resize(ret);
buf.i = buf.b.end();
return true;
}
#ifdef ICE_USE_IOCP
bool
IceInternal::UdpTransceiver::startWrite(Buffer& buf)
{
assert(buf.i == buf.b.begin());
// The caller is supposed to check the send size before by calling checkSendSize
assert(min(_maxPacketSize, _sndSize - _udpOverhead) >= static_cast<int>(buf.b.size()));
assert(_fd != INVALID_SOCKET);
_write.buf.len = static_cast<int>(buf.b.size());
_write.buf.buf = reinterpret_cast<char*>(&*buf.i);
int err;
if(_state == StateConnected)
{
err = WSASend(_fd, &_write.buf, 1, &_write.count, 0, &_write, NULL);
}
else
{
socklen_t len = static_cast<socklen_t>(sizeof(_peerAddr));
if(_peerAddr.ss_family == AF_INET)
{
len = sizeof(sockaddr_in);
}
else if(_peerAddr.ss_family == AF_INET6)
{
len = sizeof(sockaddr_in6);
}
else
{
// No peer has sent a datagram yet.
SocketException ex(__FILE__, __LINE__);
ex.error = 0;
throw ex;
}
err = WSASendTo(_fd, &_write.buf, 1, &_write.count, 0, reinterpret_cast<struct sockaddr*>(&_peerAddr),
len, &_write, NULL);
}
if(err == SOCKET_ERROR)
{
if(!wouldBlock())
{
if(connectionLost())
{
ConnectionLostException ex(__FILE__, __LINE__);
ex.error = getSocketErrno();
throw ex;
}
else
{
SocketException ex(__FILE__, __LINE__);
ex.error = getSocketErrno();
throw ex;
}
}
}
return true;
}
void
IceInternal::UdpTransceiver::finishWrite(Buffer& buf)
{
if(_write.count == SOCKET_ERROR)
{
WSASetLastError(_write.error);
if(connectionLost())
{
ConnectionLostException ex(__FILE__, __LINE__);
ex.error = getSocketErrno();
throw ex;
}
else
{
SocketException ex(__FILE__, __LINE__);
ex.error = getSocketErrno();
throw ex;
}
}
if(_traceLevels->network >= 3)
{
Trace out(_logger, _traceLevels->networkCat);
out << "sent " << _write.count << " bytes via udp\n" << toString();
}
if(_stats)
{
_stats->bytesSent(type(), static_cast<Int>(_write.count));
}
assert(_write.count == static_cast<ssize_t>(buf.b.size()));
buf.i = buf.b.end();
}
void
IceInternal::UdpTransceiver::startRead(Buffer& buf)
{
const int packetSize = min(_maxPacketSize, _rcvSize - _udpOverhead);
buf.b.resize(packetSize);
buf.i = buf.b.begin();
assert(!buf.b.empty() && buf.i != buf.b.end());
_read.buf.len = packetSize;
_read.buf.buf = reinterpret_cast<char*>(&*buf.i);
int err;
if(_state == StateConnected)
{
err = WSARecv(_fd, &_read.buf, 1, &_read.count, &_read.flags, &_read, NULL);
}
else
{
memset(&_readAddr, 0, sizeof(struct sockaddr_storage));
_readAddrLen = static_cast<socklen_t>(sizeof(_readAddr));
err = WSARecvFrom(_fd, &_read.buf, 1, &_read.count, &_read.flags,
reinterpret_cast<struct sockaddr*>(&_readAddr), &_readAddrLen, &_read, NULL);
}
if(err == SOCKET_ERROR)
{
if(recvTruncated())
{
// Nothing to do.
}
else if(!wouldBlock())
{
if(connectionLost())
{
ConnectionLostException ex(__FILE__, __LINE__);
ex.error = getSocketErrno();
throw ex;
}
else
{
SocketException ex(__FILE__, __LINE__);
ex.error = getSocketErrno();
throw ex;
}
}
}
}
void
IceInternal::UdpTransceiver::finishRead(Buffer& buf)
{
if(_read.count == SOCKET_ERROR)
{
WSASetLastError(_read.error);
if(recvTruncated())
{
// The message was truncated and the whole buffer is filled. We ignore
// this error here, it will be detected at the connection level when
// the Ice message size is checked against the buffer size.
_read.count = static_cast<int>(buf.b.size());
}
else
{
if(connectionLost())
{
ConnectionLostException ex(__FILE__, __LINE__);
ex.error = getSocketErrno();
throw ex;
}
else
{
SocketException ex(__FILE__, __LINE__);
ex.error = getSocketErrno();
throw ex;
}
}
}
if(_state == StateNotConnected)
{
_peerAddr = _readAddr;
}
if(_traceLevels->network >= 3)
{
Trace out(_logger, _traceLevels->networkCat);
out << "received " << _read.count << " bytes via udp\n" << toString();
}
if(_stats)
{
_stats->bytesReceived(type(), static_cast<Int>(_read.count));
}
buf.b.resize(_read.count);
buf.i = buf.b.end();
}
#endif
string
IceInternal::UdpTransceiver::type() const
{
return "udp";
}
string
IceInternal::UdpTransceiver::toString() const
{
if(_fd == INVALID_SOCKET)
{
return "<closed>";
}
ostringstream s;
if(_state == StateNotConnected)
{
struct sockaddr_storage localAddr;
fdToLocalAddress(_fd, localAddr);
s << "local address = " << addrToString(localAddr);
if(_peerAddr.ss_family != AF_UNSPEC)
{
s << "\nremote address = " << addrToString(_peerAddr);
}
}
else
{
s << fdToString(_fd);
}
if(_mcastAddr.ss_family != AF_UNSPEC)
{
s << "\nmulticast address = " + addrToString(_mcastAddr);
}
return s.str();
}
Ice::ConnectionInfoPtr
IceInternal::UdpTransceiver::getInfo() const
{
assert(_fd != INVALID_SOCKET);
Ice::UDPConnectionInfoPtr info = new Ice::UDPConnectionInfo();
if(_state == StateNotConnected)
{
struct sockaddr_storage localAddr;
fdToLocalAddress(_fd, localAddr);
addrToAddressAndPort(localAddr, info->localAddress, info->localPort);
if(_peerAddr.ss_family != AF_UNSPEC)
{
addrToAddressAndPort(_peerAddr, info->remoteAddress, info->remotePort);
}
else
{
info->remotePort = 0;
}
}
else
{
fdToAddressAndPort(_fd, info->localAddress, info->localPort, info->remoteAddress, info->remotePort);
}
if(_mcastAddr.ss_family != AF_UNSPEC)
{
addrToAddressAndPort(_mcastAddr, info->mcastAddress, info->mcastPort);
}
else
{
info->mcastPort = 0;
}
return info;
}
void
IceInternal::UdpTransceiver::checkSendSize(const Buffer& buf, size_t messageSizeMax)
{
if(buf.b.size() > messageSizeMax)
{
Ex::throwMemoryLimitException(__FILE__, __LINE__, buf.b.size(), messageSizeMax);
}
//
// The maximum packetSize is either the maximum allowable UDP packet size, or
// the UDP send buffer size (which ever is smaller).
//
const int packetSize = min(_maxPacketSize, _sndSize - _udpOverhead);
if(packetSize < static_cast<int>(buf.b.size()))
{
throw DatagramLimitException(__FILE__, __LINE__);
}
}
int
IceInternal::UdpTransceiver::effectivePort() const
{
return getPort(_addr);
}
IceInternal::UdpTransceiver::UdpTransceiver(const InstancePtr& instance, const struct sockaddr_storage& addr,
const string& mcastInterface, int mcastTtl) :
_traceLevels(instance->traceLevels()),
_logger(instance->initializationData().logger),
_stats(instance->initializationData().stats),
_incoming(false),
_addr(addr),
_state(StateNeedConnect)
#ifdef ICE_USE_IOCP
, _read(SocketOperationRead),
_write(SocketOperationWrite)
#endif
{
_mcastAddr.ss_family = AF_UNSPEC; // AF_UNSPEC means not multicast.
_peerAddr.ss_family = AF_UNSPEC; // Not initialized yet.
_fd = createSocket(true, _addr.ss_family);
setBufSize(instance);
setBlock(_fd, false);
//
// In general, connecting a datagram socket should be non-blocking as this just setups
// the default destination address for the socket. However, on some OS, connect sometime
// returns EWOULDBLOCK. If that's the case, we keep the state as StateNeedConnect. This
// will make sure the transceiver is notified when the socket is ready for sending (see
// the initialize() implementation).
//
if(doConnect(_fd, _addr))
{
_state = StateConnected;
}
#ifdef ICE_USE_IOCP
//
// On Windows when using IOCP, we must make sure that the socket is connected without
// blocking as there's no way to do a non-blocking datagram socket conection (ConnectEx
// only supports connection oriented sockets). According to Microsoft documentation of
// the connect() call, this should always be the case.
//
assert(_state == StateConnected);
#endif
if(isMulticast(_addr))
{
if(mcastInterface.length() > 0)
{
setMcastInterface(_fd, mcastInterface, _addr.ss_family == AF_INET);
}
if(mcastTtl != -1)
{
setMcastTtl(_fd, mcastTtl, _addr.ss_family == AF_INET);
}
}
}
IceInternal::UdpTransceiver::UdpTransceiver(const InstancePtr& instance, const string& host, int port,
const string& mcastInterface, bool connect) :
_traceLevels(instance->traceLevels()),
_logger(instance->initializationData().logger),
_stats(instance->initializationData().stats),
_incoming(true),
_addr(getAddressForServer(host, port, instance->protocolSupport())),
_state(connect ? StateNeedConnect : StateNotConnected)
#ifdef ICE_USE_IOCP
, _read(SocketOperationRead),
_write(SocketOperationWrite)
#endif
{
memset(&_mcastAddr, 0, sizeof(_mcastAddr));
memset(&_peerAddr, 0, sizeof(_peerAddr));
_fd = createSocket(true, _addr.ss_family);
setBufSize(instance);
setBlock(_fd, false);
if(_traceLevels->network >= 2)
{
Trace out(_logger, _traceLevels->networkCat);
out << "attempting to bind to udp socket " << addrToString(_addr);
}
_peerAddr.ss_family = AF_UNSPEC; // Not assigned yet.
if(isMulticast(_addr))
{
setReuseAddress(_fd, true);
_mcastAddr = _addr;
#ifdef _WIN32
//
// Windows does not allow binding to the mcast address itself
// so we bind to INADDR_ANY (0.0.0.0) instead. As a result,
// bi-directional connection won't work because the source
// address won't be the multicast address and the client will
// therefore reject the datagram.
//
const_cast<struct sockaddr_storage&>(_addr) =
getAddressForServer("", port, _mcastAddr.ss_family == AF_INET ? EnableIPv4 : EnableIPv6);
#endif
const_cast<struct sockaddr_storage&>(_addr) = doBind(_fd, _addr);
if(getPort(_mcastAddr) == 0)
{
setPort(_mcastAddr, getPort(_addr));
}
setMcastGroup(_fd, _mcastAddr, mcastInterface);
}
else
{
#ifndef _WIN32
//
// Enable SO_REUSEADDR on Unix platforms to allow re-using
// the socket even if it's in the TIME_WAIT state. On
// Windows, this doesn't appear to be necessary and
// enabling SO_REUSEADDR would actually not be a good
// thing since it allows a second process to bind to an
// address even it's already bound by another process.
//
// TODO: using SO_EXCLUSIVEADDRUSE on Windows would
// probably be better but it's only supported by recent
// Windows versions (XP SP2, Windows Server 2003).
//
setReuseAddress(_fd, true);
#endif
const_cast<struct sockaddr_storage&>(_addr) = doBind(_fd, _addr);
_mcastAddr.ss_family = AF_UNSPEC; // AF_UNSPEC means not multicast.
}
if(_traceLevels->network >= 1)
{
Trace out(_logger, _traceLevels->networkCat);
out << "starting to receive udp packets\n" << toString();
vector<string> interfaces =
getHostsForEndpointExpand(inetAddrToString(_addr), instance->protocolSupport(), true);
if(!interfaces.empty())
{
out << "\nlocal interfaces: ";
out << IceUtilInternal::joinString(interfaces, ", ");
}
}
}
IceInternal::UdpTransceiver::~UdpTransceiver()
{
assert(_fd == INVALID_SOCKET);
}
//
// Set UDP receive and send buffer sizes.
//
void
IceInternal::UdpTransceiver::setBufSize(const InstancePtr& instance)
{
assert(_fd != INVALID_SOCKET);
for(int i = 0; i < 2; ++i)
{
string direction;
string prop;
int* addr;
int dfltSize;
if(i == 0)
{
direction = "receive";
prop = "Ice.UDP.RcvSize";
addr = &_rcvSize;
dfltSize = getRecvBufferSize(_fd);
_rcvSize = dfltSize;
}
else
{
direction = "send";
prop = "Ice.UDP.SndSize";
addr = &_sndSize;
dfltSize = getSendBufferSize(_fd);
_sndSize = dfltSize;
}
//
// Get property for buffer size and check for sanity.
//
Int sizeRequested = instance->initializationData().properties->getPropertyAsIntWithDefault(prop, dfltSize);
if(sizeRequested < (_udpOverhead + headerSize))
{
Warning out(_logger);
out << "Invalid " << prop << " value of " << sizeRequested << " adjusted to " << dfltSize;
sizeRequested = dfltSize;
}
if(sizeRequested != dfltSize)
{
//
// Try to set the buffer size. The kernel will silently adjust
// the size to an acceptable value. Then read the size back to
// get the size that was actually set.
//
if(i == 0)
{
setRecvBufferSize(_fd, sizeRequested);
*addr = getRecvBufferSize(_fd);
}
else
{
setSendBufferSize(_fd, sizeRequested);
*addr = getSendBufferSize(_fd);
}
//
// Warn if the size that was set is less than the requested size.
//
if(*addr < sizeRequested)
{
Warning out(_logger);
out << "UDP " << direction << " buffer size: requested size of "
<< sizeRequested << " adjusted to " << *addr;
}
}
}
}
//
// The maximum IP datagram size is 65535. Subtract 20 bytes for the IP header and 8 bytes for the UDP header
// to get the maximum payload.
//
const int IceInternal::UdpTransceiver::_udpOverhead = 20 + 8;
const int IceInternal::UdpTransceiver::_maxPacketSize = 65535 - _udpOverhead;
|