.NET Multicast Socket Error -
i have app uses 2 multicast channels, so
_sock = new socket(addressfamily.internetwork, sockettype.dgram, protocoltype.udp);             ipendpoint iep = new ipendpoint(ipaddress.any, 30002); _sock.bind(iep); _sock.setsocketoption(socketoptionlevel.ip, socketoptionname.addmembership, new multicastoption(ipaddress.parse("239.255.0.2"))); ...   later on, in same app
_sock2 = new socket(addressfamily.internetwork, sockettype.dgram, protocoltype.udp);             ipendpoint iep = new ipendpoint(ipaddress.any, 30001); _sock2.bind(iep); _sock2.setsocketoption(socketoptionlevel.ip, socketoptionname.addmembership, new multicastoption(ipaddress.parse("239.255.0.2")));   (notice different ports).
when execution point reaches second bind exception (hresult 0x80004005) raised, warning me 1 protocol/address/port can used...
i have done in c++ apps think ther must error.
what wrong that?
thank in advance
ok, i've got it:
_sock.setsocketoption(socketoptionlevel.socket, socketoptionname.reuseaddress, 1);    before first bind
Comments
Post a Comment