Wednesday 15 June 2011

c# - Socket Error The requested address is not valid in its context -



c# - Socket Error The requested address is not valid in its context -

while trying set socketoption using :

listener.setsocketoption(socketoptionlevel.ip, socketoptionname.addmembership, new multicastoption(ipaddress));

i getting next exception ;

the requested address not valid in context

my listmer is:

socket listener = new socket(addressfamily.internetwork, sockettype.dgram, protocoltype.udp);

and ip 3.212.x.x

is problem because of ip ?

the problem in statement:

listener.setsocketoption(socketoptionlevel.ip, socketoptionname.addmembership, new multicastoption(ipaddress));

msdn outline constructor :

public multicastoption( ipaddress grouping )

so multicastoption looks grouping broadcast had passed localip , problem.

i instead updated code:

ipaddress ip = ipaddress.parse("224.5.6.7"); socket _socketserver = new socket(addressfamily.internetwork, sockettype.dgram, protocoltype.udp); _socketserver.setsocketoption(socketoptionlevel.ip, socketoptionname.addmembership, new multicastoption(ip)); _socketserver.setsocketoption(socketoptionlevel.ip, socketoptionname.multicasttimetolive, 1);

c# sockets multicast

3 comments:

  1. Nice tutorial. Thanks for sharing the valuable information. it’s really helpful. Who want to learn this blog most helpful. Keep sharing on updated tutorials…
    Best Devops Training in pune
    Best Devops Training institute in Chennai

    ReplyDelete
  2. This is such a good post. One of the best posts that I\'ve read in my whole life. I am so happy that you chose this day to give me this. Please, continue to give me such valuable posts. Cheers!

    python training in chennai
    python course institute in chennai

    ReplyDelete