Logo
~Sockets~
~Examples~
~Contact~


UdpSocket Class Reference
[Basic sockets]

Socket implementation for UDP. More...

#include <UdpSocket.h>

Inheritance diagram for UdpSocket:
Collaboration diagram for UdpSocket:

List of all members.


Public Member Functions

 UdpSocket (ISocketHandler &h, int ibufsz=16384, bool ipv6=false, int retries=0)
 Constructor.
 ~UdpSocket ()
virtual void OnRawData (const char *buf, size_t len, struct sockaddr *sa, socklen_t sa_len)
 Called when incoming data has been received.
virtual void OnRawData (const char *buf, size_t len, struct sockaddr *sa, socklen_t sa_len, struct timeval *ts)
 Called when incoming data has been received and read timestamp is enabled.
int Bind (port_t &port, int range=1)
 To receive incoming data, call Bind to setup an incoming port.
int Bind (const std::string &intf, port_t &port, int range=1)
 To receive data on a specific interface:port, use this.
int Bind (ipaddr_t a, port_t &port, int range=1)
 To receive data on a specific interface:port, use this.
int Bind (SocketAddress &ad, int range=1)
 To receive data on a specific interface:port, use this.
bool Open (ipaddr_t l, port_t port)
 Define remote host.
bool Open (const std::string &host, port_t port)
 Define remote host.
bool Open (SocketAddress &ad)
 Define remote host.
void SendToBuf (const std::string &, port_t, const char *data, int len, int flags=0)
 Send to specified host.
void SendToBuf (ipaddr_t, port_t, const char *data, int len, int flags=0)
 Send to specified address.
void SendToBuf (SocketAddress &ad, const char *data, int len, int flags=0)
 Send to specified socket address.
void SendTo (const std::string &, port_t, const std::string &, int flags=0)
 Send string to specified host.
void SendTo (ipaddr_t, port_t, const std::string &, int flags=0)
 Send string to specified address.
void SendTo (SocketAddress &ad, const std::string &, int flags=0)
 Send string to specified socket address.
void SendBuf (const char *data, size_t, int flags=0)
 Send to connected address.
void Send (const std::string &, int flags=0)
 Send string to connected address.
void SetBroadcast (bool b=true)
 Set broadcast.
bool IsBroadcast ()
 Check broadcast flag.
void SetMulticastTTL (int ttl=1)
 multicast
int GetMulticastTTL ()
void SetMulticastLoop (bool=true)
bool IsMulticastLoop ()
void AddMulticastMembership (const std::string &group, const std::string &intf="0.0.0.0", int if_index=0)
void DropMulticastMembership (const std::string &group, const std::string &intf="0.0.0.0", int if_index=0)
bool IsBound ()
 Returns true if Bind succeeded.
port_t GetPort ()
 Return Bind port number.
void OnOptions (int, int, int, SOCKET)
 Called when a client socket is created, to set socket options.
int GetLastSizeWritten ()
void SetTimestamp (bool=true)
 Also read timestamp information from incoming message.

Protected Member Functions

 UdpSocket (const UdpSocket &s)
void OnRead ()
 Called when there is something to be read from the file descriptor.

Private Member Functions

UdpSocketoperator= (const UdpSocket &)
void CreateConnection ()
 create before using sendto methods

Private Attributes

char * m_ibuf
 Input buffer.
int m_ibufsz
 Size of input buffer.
bool m_bind_ok
 Bind completed successfully.
port_t m_port
 Bind port number.
int m_last_size_written
int m_retries
bool m_b_read_ts

Detailed Description

Socket implementation for UDP.

Definition at line 42 of file UdpSocket.h.


Constructor & Destructor Documentation

UdpSocket::UdpSocket ( ISocketHandler h,
int  ibufsz = 16384,
bool  ipv6 = false,
int  retries = 0 
)

Constructor.

Parameters:
h ISocketHandler reference
ibufsz Maximum size of receive message (extra bytes will be truncated)
ipv6 'true' if this is an ipv6 socket

Definition at line 56 of file UdpSocket.cpp.

00056                                                                           : Socket(h)
00057 , m_ibuf(new char[ibufsz])
00058 , m_ibufsz(ibufsz)
00059 , m_bind_ok(false)
00060 , m_port(0)
00061 , m_last_size_written(-1)
00062 , m_retries(retries)
00063 , m_b_read_ts(false)
00064 {
00065 #ifdef ENABLE_IPV6
00066 #ifdef IPPROTO_IPV6
00067         SetIpv6(ipv6);
00068 #endif
00069 #endif
00070 }

UdpSocket::~UdpSocket (  ) 

Definition at line 73 of file UdpSocket.cpp.

References Socket::Close(), and m_ibuf.

00074 {
00075         Close();
00076         delete[] m_ibuf;
00077 }

UdpSocket::UdpSocket ( const UdpSocket s  )  [inline, protected]

Definition at line 189 of file UdpSocket.h.

00189 : Socket(s) {}


Member Function Documentation

void UdpSocket::OnRawData ( const char *  buf,
size_t  len,
struct sockaddr *  sa,
socklen_t  sa_len 
) [virtual]

Called when incoming data has been received.

Parameters:
buf Pointer to data
len Length of data
sa Pointer to sockaddr struct of sender
sa_len Length of sockaddr struct

Definition at line 820 of file UdpSocket.cpp.

Referenced by OnRead().

00821 {
00822 }

void UdpSocket::OnRawData ( const char *  buf,
size_t  len,
struct sockaddr *  sa,
socklen_t  sa_len,
struct timeval *  ts 
) [virtual]

Called when incoming data has been received and read timestamp is enabled.

Parameters:
buf Pointer to data
len Length of data
sa Pointer to sockaddr struct of sender
sa_len Length of sockaddr struct
ts Timestamp from message

Definition at line 825 of file UdpSocket.cpp.

00826 {
00827 }

int UdpSocket::Bind ( port_t port,
int  range = 1 
)

To receive incoming data, call Bind to setup an incoming port.

Parameters:
port Incoming port number
range Port range to try if ports already in use
Returns:
0 if bind succeeded

Definition at line 80 of file UdpSocket.cpp.

Referenced by Bind().

00081 {
00082 #ifdef ENABLE_IPV6
00083 #ifdef IPPROTO_IPV6
00084         if (IsIpv6())
00085         {
00086                 Ipv6Address ad(port);
00087                 return Bind(ad, range);
00088         }
00089 #endif
00090 #endif
00091         Ipv4Address ad(port);
00092         return Bind(ad, range);
00093 }

int UdpSocket::Bind ( const std::string &  intf,
port_t port,
int  range = 1 
)

To receive data on a specific interface:port, use this.

Parameters:
intf Interface ip/hostname
port Port number
range Port range
Returns:
0 if bind succeeded

Definition at line 96 of file UdpSocket.cpp.

References Bind(), Ipv4Address::IsValid(), and Socket::SetCloseAndDelete().

00097 {
00098 #ifdef ENABLE_IPV6
00099 #ifdef IPPROTO_IPV6
00100         if (IsIpv6())
00101         {
00102                 Ipv6Address ad(intf, port);
00103                 if (ad.IsValid())
00104                 {
00105                         return Bind(ad, range);
00106                 }
00107                 SetCloseAndDelete();
00108                 return -1;
00109         }
00110 #endif
00111 #endif
00112         Ipv4Address ad(intf, port);
00113         if (ad.IsValid())
00114         {
00115                 return Bind(ad, range);
00116         }
00117         SetCloseAndDelete();
00118         return -1;
00119 }

int UdpSocket::Bind ( ipaddr_t  a,
port_t port,
int  range = 1 
)

To receive data on a specific interface:port, use this.

Parameters:
a Ip address
port Port number
range Port range
Returns:
0 if bind succeeded

Definition at line 122 of file UdpSocket.cpp.

References Bind().

00123 {
00124         Ipv4Address ad(a, port);
00125         return Bind(ad, range);
00126 }

int UdpSocket::Bind ( SocketAddress ad,
int  range = 1 
)

To receive data on a specific interface:port, use this.

Parameters:
ad Socket address
range Port range
Returns:
0 if bind succeeded

Definition at line 140 of file UdpSocket.cpp.

References Socket::Attach(), Socket::CreateSocket(), Errno, SocketAddress::GetFamily(), SocketAddress::GetPort(), Socket::GetSocket(), Socket::Handler(), INVALID_SOCKET, Utility::l2string(), LOG_LEVEL_FATAL, ISocketHandler::LogError(), m_bind_ok, m_port, Socket::SetCloseAndDelete(), Socket::SetNonblocking(), SocketAddress::SetPort(), and StrError.

00141 {
00142         if (GetSocket() == INVALID_SOCKET)
00143         {
00144                 Attach(CreateSocket(ad.GetFamily(), SOCK_DGRAM, "udp"));
00145         }
00146         if (GetSocket() != INVALID_SOCKET)
00147         {
00148                 SetNonblocking(true);
00149                 int n = bind(GetSocket(), ad, ad);
00150                 int tries = range;
00151                 while (n == -1 && tries--)
00152                 {
00153                         ad.SetPort(ad.GetPort() + 1);
00154                         n = bind(GetSocket(), ad, ad);
00155                 }
00156                 if (n == -1)
00157                 {
00158                         Handler().LogError(this, "bind", Errno, StrError(Errno), LOG_LEVEL_FATAL);
00159                         SetCloseAndDelete();
00160 #ifdef ENABLE_EXCEPTIONS
00161                         throw Exception("bind() failed for UdpSocket, port:range: " + Utility::l2string(ad.GetPort()) + ":" + Utility::l2string(range));
00162 #endif
00163                         return -1;
00164                 }
00165                 m_bind_ok = true;
00166                 m_port = ad.GetPort();
00167                 return 0;
00168         }
00169         return -1;
00170 }

bool UdpSocket::Open ( ipaddr_t  l,
port_t  port 
)

Define remote host.

if you wish to use Send, first Open a connection

Parameters:
l Address of remote host
port Port of remote host
Returns:
true if successful

Definition at line 174 of file UdpSocket.cpp.

Referenced by Open().

00175 {
00176         Ipv4Address ad(l, port);
00177         return Open(ad);
00178 }

bool UdpSocket::Open ( const std::string &  host,
port_t  port 
)

Define remote host.

Parameters:
host Hostname
port Port number
Returns:
true if successful

Definition at line 181 of file UdpSocket.cpp.

References Ipv4Address::IsValid(), and Open().

00182 {
00183 #ifdef ENABLE_IPV6
00184 #ifdef IPPROTO_IPV6
00185         if (IsIpv6())
00186         {
00187                 Ipv6Address ad(host, port);
00188                 if (ad.IsValid())
00189                 {
00190                         return Open(ad);
00191                 }
00192                 return false;
00193         }
00194 #endif
00195 #endif
00196         Ipv4Address ad(host, port);
00197         if (ad.IsValid())
00198         {
00199                 return Open(ad);
00200         }
00201         return false;
00202 }

bool UdpSocket::Open ( SocketAddress ad  ) 

Define remote host.

Parameters:
ad Socket address
Returns:
true if successful

Definition at line 216 of file UdpSocket.cpp.

References Socket::Attach(), Socket::CreateSocket(), Errno, SocketAddress::GetFamily(), Socket::GetSocket(), Socket::Handler(), INVALID_SOCKET, LOG_LEVEL_FATAL, ISocketHandler::LogError(), Socket::SetCloseAndDelete(), Socket::SetConnected(), Socket::SetNonblocking(), and StrError.

00217 {
00218         if (GetSocket() == INVALID_SOCKET)
00219         {
00220                 Attach(CreateSocket(ad.GetFamily(), SOCK_DGRAM, "udp"));
00221         }
00222         if (GetSocket() != INVALID_SOCKET)
00223         {
00224                 SetNonblocking(true);
00225                 if (connect(GetSocket(), ad, ad) == -1)
00226                 {
00227                         Handler().LogError(this, "connect", Errno, StrError(Errno), LOG_LEVEL_FATAL);
00228                         SetCloseAndDelete();
00229                         return false;
00230                 }
00231                 SetConnected();
00232                 return true;
00233         }
00234         return false;
00235 }

void UdpSocket::SendToBuf ( const std::string &  h,
port_t  p,
const char *  data,
int  len,
int  flags = 0 
)

Send to specified host.

send to specified address

Definition at line 272 of file UdpSocket.cpp.

References Ipv4Address::IsValid().

Referenced by SendTo(), and SendToBuf().

00273 {
00274 #ifdef ENABLE_IPV6
00275 #ifdef IPPROTO_IPV6
00276         if (IsIpv6())
00277         {
00278                 Ipv6Address ad(h, p);
00279                 if (ad.IsValid())
00280                 {
00281                         SendToBuf(ad, data, len, flags);
00282                 }
00283                 return;
00284         }
00285 #endif
00286 #endif
00287         Ipv4Address ad(h, p);
00288         if (ad.IsValid())
00289         {
00290                 SendToBuf(ad, data, len, flags);
00291         }
00292 }

void UdpSocket::SendToBuf ( ipaddr_t  a,
port_t  p,
const char *  data,
int  len,
int  flags = 0 
)

Send to specified address.

send to specified address

Definition at line 296 of file UdpSocket.cpp.

References SendToBuf().

00297 {
00298         Ipv4Address ad(a, p);
00299         SendToBuf(ad, data, len, flags);
00300 }

void UdpSocket::SendToBuf ( SocketAddress ad,
const char *  data,
int  len,
int  flags = 0 
)

Send to specified socket address.

Definition at line 314 of file UdpSocket.cpp.

References Socket::Attach(), Socket::CreateSocket(), Errno, SocketAddress::GetFamily(), Socket::GetSocket(), Socket::Handler(), INVALID_SOCKET, LOG_LEVEL_ERROR, ISocketHandler::LogError(), m_last_size_written, Socket::SetNonblocking(), and StrError.

00315 {
00316         if (GetSocket() == INVALID_SOCKET)
00317         {
00318                 Attach(CreateSocket(ad.GetFamily(), SOCK_DGRAM, "udp"));
00319         }
00320         if (GetSocket() != INVALID_SOCKET)
00321         {
00322                 SetNonblocking(true);
00323                 if ((m_last_size_written = sendto(GetSocket(), data, len, flags, ad, ad)) == -1)
00324                 {
00325                         Handler().LogError(this, "sendto", Errno, StrError(Errno), LOG_LEVEL_ERROR);
00326                 }
00327         }
00328 }

void UdpSocket::SendTo ( const std::string &  a,
port_t  p,
const std::string &  str,
int  flags = 0 
)

Send string to specified host.

Definition at line 331 of file UdpSocket.cpp.

References SendToBuf().

00332 {
00333         SendToBuf(a, p, str.c_str(), (int)str.size(), flags);
00334 }

void UdpSocket::SendTo ( ipaddr_t  a,
port_t  p,
const std::string &  str,
int  flags = 0 
)

Send string to specified address.

Definition at line 337 of file UdpSocket.cpp.

References SendToBuf().

00338 {
00339         SendToBuf(a, p, str.c_str(), (int)str.size(), flags);
00340 }

void UdpSocket::SendTo ( SocketAddress ad,
const std::string &  str,
int  flags = 0 
)

Send string to specified socket address.

Definition at line 353 of file UdpSocket.cpp.

References SendToBuf().

00354 {
00355         SendToBuf(ad, str.c_str(), (int)str.size(), flags);
00356 }

void UdpSocket::SendBuf ( const char *  data,
size_t  len,
int  flags = 0 
) [virtual]

Send to connected address.

send to connected address

Reimplemented from Socket.

Definition at line 360 of file UdpSocket.cpp.

References Errno, Socket::GetSocket(), Socket::Handler(), Socket::IsConnected(), LOG_LEVEL_ERROR, ISocketHandler::LogError(), m_last_size_written, and StrError.

Referenced by Send().

00361 {
00362         if (!IsConnected())
00363         {
00364                 Handler().LogError(this, "SendBuf", 0, "not connected", LOG_LEVEL_ERROR);
00365                 return;
00366         }
00367         if ((m_last_size_written = send(GetSocket(), data, (int)len, flags)) == -1)
00368         {
00369                 Handler().LogError(this, "send", Errno, StrError(Errno), LOG_LEVEL_ERROR);
00370         }
00371 }

void UdpSocket::Send ( const std::string &  str,
int  flags = 0 
) [virtual]

Send string to connected address.

Reimplemented from Socket.

Definition at line 374 of file UdpSocket.cpp.

References SendBuf().

00375 {
00376         SendBuf(str.c_str(), (int)str.size(), flags);
00377 }

void UdpSocket::SetBroadcast ( bool  b = true  ) 

Set broadcast.

Definition at line 559 of file UdpSocket.cpp.

References CreateConnection(), Errno, Socket::GetSocket(), Socket::Handler(), INVALID_SOCKET, LOG_LEVEL_WARNING, ISocketHandler::LogError(), and StrError.

00560 {
00561         int one = 1;
00562         int zero = 0;
00563 
00564         if (GetSocket() == INVALID_SOCKET)
00565         {
00566                 CreateConnection();
00567         }
00568         if (b)
00569         {
00570                 if (setsockopt(GetSocket(), SOL_SOCKET, SO_BROADCAST, (char *) &one, sizeof(one)) == -1)
00571                 {
00572                         Handler().LogError(this, "SetBroadcast", Errno, StrError(Errno), LOG_LEVEL_WARNING);
00573                 }
00574         }
00575         else
00576         {
00577                 if (setsockopt(GetSocket(), SOL_SOCKET, SO_BROADCAST, (char *) &zero, sizeof(zero)) == -1)
00578                 {
00579                         Handler().LogError(this, "SetBroadcast", Errno, StrError(Errno), LOG_LEVEL_WARNING);
00580                 }
00581         }
00582 }

bool UdpSocket::IsBroadcast (  ) 

Check broadcast flag.

Returns:
true broadcast is enabled.

Definition at line 585 of file UdpSocket.cpp.

References CreateConnection(), Errno, Socket::GetSocket(), Socket::Handler(), INVALID_SOCKET, LOG_LEVEL_WARNING, ISocketHandler::LogError(), and StrError.

00586 {
00587         int is_broadcast = 0;
00588         socklen_t size;
00589 
00590         if (GetSocket() == INVALID_SOCKET)
00591         {
00592                 CreateConnection();
00593         }
00594         if (getsockopt(GetSocket(), SOL_SOCKET, SO_BROADCAST, (char *)&is_broadcast, &size) == -1)
00595         {
00596                 Handler().LogError(this, "IsBroadcast", Errno, StrError(Errno), LOG_LEVEL_WARNING);
00597         }
00598         return is_broadcast != 0;
00599 }

void UdpSocket::SetMulticastTTL ( int  ttl = 1  ) 

multicast

Definition at line 602 of file UdpSocket.cpp.

References CreateConnection(), Errno, Socket::GetSocket(), Socket::Handler(), INVALID_SOCKET, LOG_LEVEL_WARNING, ISocketHandler::LogError(), SOL_IP, and StrError.

00603 {
00604         if (GetSocket() == INVALID_SOCKET)
00605         {
00606                 CreateConnection();
00607         }
00608         if (setsockopt(GetSocket(), SOL_IP, IP_MULTICAST_TTL, (char *)&ttl, sizeof(int)) == -1)
00609         {
00610                 Handler().LogError(this, "SetMulticastTTL", Errno, StrError(Errno), LOG_LEVEL_WARNING);
00611         }
00612 }

int UdpSocket::GetMulticastTTL (  ) 

Definition at line 615 of file UdpSocket.cpp.

References CreateConnection(), Errno, Socket::GetSocket(), Socket::Handler(), INVALID_SOCKET, LOG_LEVEL_WARNING, ISocketHandler::LogError(), SOL_IP, and StrError.

00616 {
00617         int ttl = 0;
00618         socklen_t size = sizeof(int);
00619 
00620         if (GetSocket() == INVALID_SOCKET)
00621         {
00622                 CreateConnection();
00623         }
00624         if (getsockopt(GetSocket(), SOL_IP, IP_MULTICAST_TTL, (char *)&ttl, &size) == -1)
00625         {
00626                 Handler().LogError(this, "GetMulticastTTL", Errno, StrError(Errno), LOG_LEVEL_WARNING);
00627         }
00628         return ttl;
00629 }

void UdpSocket::SetMulticastLoop ( bool  x = true  ) 

Reimplemented from Socket.

Definition at line 632 of file UdpSocket.cpp.

References CreateConnection(), Errno, Socket::GetSocket(), Socket::Handler(), INVALID_SOCKET, LOG_LEVEL_WARNING, ISocketHandler::LogError(), SOL_IP, and StrError.

00633 {
00634         if (GetSocket() == INVALID_SOCKET)
00635         {
00636                 CreateConnection();
00637         }
00638 #ifdef ENABLE_IPV6
00639 #ifdef IPPROTO_IPV6
00640         if (IsIpv6())
00641         {
00642                 int val = x ? 1 : 0;
00643                 if (setsockopt(GetSocket(), IPPROTO_IPV6, IPV6_MULTICAST_LOOP, (char *)&val, sizeof(int)) == -1)
00644                 {
00645                         Handler().LogError(this, "SetMulticastLoop", Errno, StrError(Errno), LOG_LEVEL_WARNING);
00646                 }
00647                 return;
00648         }
00649 #endif
00650 #endif
00651         int val = x ? 1 : 0;
00652         if (setsockopt(GetSocket(), SOL_IP, IP_MULTICAST_LOOP, (char *)&val, sizeof(int)) == -1)
00653         {
00654                 Handler().LogError(this, "SetMulticastLoop", Errno, StrError(Errno), LOG_LEVEL_WARNING);
00655         }
00656 }

bool UdpSocket::IsMulticastLoop (  ) 

Definition at line 659 of file UdpSocket.cpp.

References CreateConnection(), Errno, Socket::GetSocket(), Socket::Handler(), INVALID_SOCKET, LOG_LEVEL_WARNING, ISocketHandler::LogError(), SOL_IP, and StrError.

00660 {
00661         if (GetSocket() == INVALID_SOCKET)
00662         {
00663                 CreateConnection();
00664         }
00665 #ifdef ENABLE_IPV6
00666 #ifdef IPPROTO_IPV6
00667         if (IsIpv6())
00668         {
00669                 int is_loop = 0;
00670                 socklen_t size = sizeof(int);
00671                 if (getsockopt(GetSocket(), IPPROTO_IPV6, IPV6_MULTICAST_LOOP, (char *)&is_loop, &size) == -1)
00672                 {
00673                         Handler().LogError(this, "IsMulticastLoop", Errno, StrError(Errno), LOG_LEVEL_WARNING);
00674                 }
00675                 return is_loop ? true : false;
00676         }
00677 #endif
00678 #endif
00679         int is_loop = 0;
00680         socklen_t size = sizeof(int);
00681         if (getsockopt(GetSocket(), SOL_IP, IP_MULTICAST_LOOP, (char *)&is_loop, &size) == -1)
00682         {
00683                 Handler().LogError(this, "IsMulticastLoop", Errno, StrError(Errno), LOG_LEVEL_WARNING);
00684         }
00685         return is_loop ? true : false;
00686 }

void UdpSocket::AddMulticastMembership ( const std::string &  group,
const std::string &  intf = "0.0.0.0",
int  if_index = 0 
)

Definition at line 689 of file UdpSocket.cpp.

References CreateConnection(), Errno, Socket::GetSocket(), Socket::Handler(), INVALID_SOCKET, LOG_LEVEL_WARNING, ISocketHandler::LogError(), SOL_IP, StrError, and Utility::u2ip().

00690 {
00691         if (GetSocket() == INVALID_SOCKET)
00692         {
00693                 CreateConnection();
00694         }
00695 #ifdef ENABLE_IPV6
00696 #ifdef IPPROTO_IPV6
00697         if (IsIpv6())
00698         {
00699                 struct ipv6_mreq x;
00700                 struct in6_addr addr;
00701                 if (Utility::u2ip( group, addr ))
00702                 {
00703                         x.ipv6mr_multiaddr = addr;
00704                         x.ipv6mr_interface = if_index;
00705                         if (setsockopt(GetSocket(), IPPROTO_IPV6, IPV6_ADD_MEMBERSHIP, (char *)&x, sizeof(struct ipv6_mreq)) == -1)
00706                         {
00707                                 Handler().LogError(this, "AddMulticastMembership", Errno, StrError(Errno), LOG_LEVEL_WARNING);
00708                         }
00709                 }
00710                 return;
00711         }
00712 #endif
00713 #endif
00714         struct ip_mreq x; // ip_mreqn
00715         ipaddr_t addr;
00716         if (Utility::u2ip( group, addr ))
00717         {
00718                 memcpy(&x.imr_multiaddr.s_addr, &addr, sizeof(addr));
00719                 Utility::u2ip( local_if, addr);
00720                 memcpy(&x.imr_interface.s_addr, &addr, sizeof(addr));
00721 //              x.imr_ifindex = if_index;
00722                 if (setsockopt(GetSocket(), SOL_IP, IP_ADD_MEMBERSHIP, (char *)&x, sizeof(struct ip_mreq)) == -1)
00723                 {
00724                         Handler().LogError(this, "AddMulticastMembership", Errno, StrError(Errno),