00001 /* 00002 * UnicastSocket.cpp 00003 * 00004 * Created on: 28.06.2010 00005 * Author: morgenro 00006 */ 00007 00008 #include "ibrcommon/net/UnicastSocket.h" 00009 #include "ibrcommon/net/vsocket.h" 00010 #include <netdb.h> 00011 00012 namespace ibrcommon 00013 { 00014 UnicastSocket::UnicastSocket() 00015 { 00016 } 00017 00018 UnicastSocket::~UnicastSocket() 00019 { 00020 } 00021 00022 void UnicastSocket::bind(int port, const vinterface &iface) 00023 { 00024 std::list<vaddress> list = iface.getAddresses(); 00025 for (std::list<vaddress>::const_iterator iter = list.begin(); iter != list.end(); iter++) 00026 { 00027 if (!iter->isBroadcast()) 00028 { 00029 bind(port, *iter); 00030 return; 00031 } 00032 } 00033 } 00034 00035 void UnicastSocket::bind(int port, const vaddress &address) 00036 { 00037 _socket.bind(address, port, SOCK_DGRAM); 00038 } 00039 00040 void UnicastSocket::bind() 00041 { 00042 _socket.bind(0, SOCK_DGRAM); 00043 } 00044 }
1.7.1