<div dir="ltr">Sending and receiving should be one the same port.<div style>It seems these functions map quite directly to regular socket functions; for multicast I have to do this (my own library, but it's quite a direct mapping):</div>
<div style><br></div><div style><div> QNAddress addr;</div><div> sock=new QNSocket(QNSocket::UNRELIABLE);</div><div> sock->Open(PORT,QNSocket::NO_BIND);</div><div> sock->BindAny(PORT);</div><div> sock->JoinMulticastGroup("226.0.0.1");</div>
<div> sock->SetMulticastLoop(false); // Don't receive our own sends</div><div> sock->SetNonBlocking(true);</div><div> while(1)</div><div> {</div><div> n=sock->Read(buf,sizeof(buf),&addr);</div>
<div> if(n>0)</div><div> {</div><div> buf[n]=0;</div><div> qdbg("Incoming packet %d bytes (%s).\n",n,buf);</div><div> }</div><div> }</div><div><br></div><div style>Where the relevant functions are:</div>
</div><div style><br></div><div style>---</div><div style><div>bool QNSocket::JoinMulticastGroup(cstring addr)</div><div>// Join a multi-cast group.</div><div>// Used for servers. I.e. addr="226.0.0.1"</div><div>
// Use a multi-cast address (224.0.0.1 - 239.255.255.255)</div><div>{</div><div> ip_mreq imreq;</div><div> int status;</div><div><br></div><div> memset(&imreq,0,sizeof(imreq));</div><div><br></div><div> imreq.imr_multiaddr.s_addr = inet_addr(addr);<br>
</div><div> imreq.imr_interface.s_addr = INADDR_ANY; // use DEFAULT interface</div><div><br></div><div> // JOIN multicast group on default interface</div><div> status = setsockopt(fd, IPPROTO_IP, IP_ADD_MEMBERSHIP, </div>
<div> (char*)&imreq, sizeof(struct ip_mreq));</div><div> return status>=0;</div><div>}</div><div>---</div><div><div>void QNSocket::SetMulticastLoop(bool yn)</div><div>// Enable loopback to local machine (yn=true) or not (yn=false)</div>
<div>// Default initial state is true</div><div>{</div><div> int status;</div><div> char b=yn;</div><div> status=setsockopt(fd,IPPROTO_IP,IP_MULTICAST_LOOP,(char*)&b,sizeof(unsigned char));</div><div>}</div></div><div>
---</div><div><br></div></div><div class="gmail_extra">Here. I call SetMulticastLoop(false) to avoid all broadcasted message to echo back to localhost (if that's what you want though).</div><div class="gmail_extra"><br>
</div><div class="gmail_extra">Cheers,</div><div class="gmail_extra">Ruud<br><br><div class="gmail_quote">On Sat, Jan 12, 2013 at 11:19 AM, enetcub <span dir="ltr"><<a href="mailto:enet_club@126.com" target="_blank">enet_club@126.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div style="FONT-FAMILY:新宋体;FONT-SIZE:9pt">
<p>HI ALL:</p>
<p> </p>
<p> </p>
<div style="TEXT-ALIGN:left;PADDING-BOTTOM:0px;TEXT-TRANSFORM:none;BACKGROUND-COLOR:rgb(250,251,252);TEXT-INDENT:0px;MARGIN:0px;PADDING-LEFT:0px;PADDING-RIGHT:0px;FONT:13px/20px helvetica,arial,verdana,tahoma,sans-serif;WHITE-SPACE:normal;LETTER-SPACING:normal;COLOR:rgb(40,40,40);WORD-SPACING:0px;PADDING-TOP:0px">
once
a client send broadcast to all host server in a same subnet, how can servers
recevice the broadcast infomation and make reply to the client </div>
<div style="TEXT-ALIGN:left;PADDING-BOTTOM:0px;TEXT-TRANSFORM:none;BACKGROUND-COLOR:rgb(250,251,252);TEXT-INDENT:0px;MARGIN:0px;PADDING-LEFT:0px;PADDING-RIGHT:0px;FONT:13px/20px helvetica,arial,verdana,tahoma,sans-serif;WHITE-SPACE:normal;LETTER-SPACING:normal;COLOR:rgb(40,40,40);WORD-SPACING:0px;PADDING-TOP:0px">
who
has send the broadcast?</div>
<div style="TEXT-ALIGN:left;PADDING-BOTTOM:0px;TEXT-TRANSFORM:none;BACKGROUND-COLOR:rgb(250,251,252);TEXT-INDENT:0px;MARGIN:0px;PADDING-LEFT:0px;PADDING-RIGHT:0px;FONT:13px/20px helvetica,arial,verdana,tahoma,sans-serif;WHITE-SPACE:normal;LETTER-SPACING:normal;COLOR:rgb(40,40,40);WORD-SPACING:0px;PADDING-TOP:0px">
</div>
<div style="TEXT-ALIGN:left;PADDING-BOTTOM:0px;TEXT-TRANSFORM:none;BACKGROUND-COLOR:rgb(250,251,252);TEXT-INDENT:0px;MARGIN:0px;PADDING-LEFT:0px;PADDING-RIGHT:0px;FONT:13px/20px helvetica,arial,verdana,tahoma,sans-serif;WHITE-SPACE:normal;LETTER-SPACING:normal;COLOR:rgb(40,40,40);WORD-SPACING:0px;PADDING-TOP:0px">
client
:</div>
<div style="TEXT-ALIGN:left;PADDING-BOTTOM:0px;TEXT-TRANSFORM:none;BACKGROUND-COLOR:rgb(250,251,252);TEXT-INDENT:0px;MARGIN:0px;PADDING-LEFT:0px;PADDING-RIGHT:0px;FONT:13px/20px helvetica,arial,verdana,tahoma,sans-serif;WHITE-SPACE:normal;LETTER-SPACING:normal;COLOR:rgb(40,40,40);WORD-SPACING:0px;PADDING-TOP:0px">
----------------------------------------------------------------</div>
<div style="TEXT-ALIGN:left;PADDING-BOTTOM:0px;TEXT-TRANSFORM:none;BACKGROUND-COLOR:rgb(250,251,252);TEXT-INDENT:0px;MARGIN:0px;PADDING-LEFT:0px;PADDING-RIGHT:0px;FONT:13px/20px helvetica,arial,verdana,tahoma,sans-serif;WHITE-SPACE:normal;LETTER-SPACING:normal;COLOR:rgb(40,40,40);WORD-SPACING:0px;PADDING-TOP:0px">
<p style="PADDING-BOTTOM:0px;MARGIN:0px;PADDING-LEFT:0px;PADDING-RIGHT:0px;PADDING-TOP:0px"> </p>
<div style="PADDING-BOTTOM:0px;MARGIN:10px 0px;PADDING-LEFT:0px;WIDTH:1065px;PADDING-RIGHT:0px;PADDING-TOP:0px">
<ul style="LIST-STYLE:square none outside;PADDING-BOTTOM:0px;MARGIN:12px 0px 12px 40px;PADDING-LEFT:0px;PADDING-RIGHT:0px;PADDING-TOP:0px">
<li style="PADDING-BOTTOM:0px;LIST-STYLE-TYPE:none;MARGIN:0px;PADDING-LEFT:0px;PADDING-RIGHT:0px;FLOAT:left;PADDING-TOP:0px"><a style="BORDER-BOTTOM:rgb(219,219,219) 1px solid;BORDER-LEFT:rgb(219,219,219) 1px solid;PADDING-BOTTOM:0px;LINE-HEIGHT:22px;MIN-HEIGHT:22px;PADDING-LEFT:10px;PADDING-RIGHT:10px;DISPLAY:inline-block;WHITE-SPACE:nowrap;min-height:22px;COLOR:rgb(97,97,97);MARGIN-LEFT:3px;FONT-SIZE:12px;BORDER-TOP:rgb(219,219,219) 1px solid;BORDER-RIGHT:rgb(219,219,219) 1px solid;PADDING-TOP:0px;border-top-left-radius:3px;border-top-right-radius:3px;border-bottom-right-radius:3px;border-bottom-left-radius:3px" title="View Code" href="http://www.gamedev.net/topic/637167-how-to-receive-broadcast-and-reply-to-broadcast-sender-by-using-enet/#" target="_blank"></a></li>
<li style="PADDING-BOTTOM:0px;LIST-STYLE-TYPE:none;MARGIN:0px;PADDING-LEFT:0px;PADDING-RIGHT:0px;FLOAT:left;PADDING-TOP:0px"><a style="BORDER-BOTTOM:rgb(219,219,219) 1px solid;BORDER-LEFT:rgb(219,219,219) 1px solid;PADDING-BOTTOM:0px;LINE-HEIGHT:22px;MIN-HEIGHT:22px;PADDING-LEFT:10px;PADDING-RIGHT:10px;DISPLAY:inline-block;WHITE-SPACE:nowrap;min-height:22px;COLOR:rgb(97,97,97);MARGIN-LEFT:3px;FONT-SIZE:12px;BORDER-TOP:rgb(219,219,219) 1px solid;BORDER-RIGHT:rgb(219,219,219) 1px solid;PADDING-TOP:0px;border-top-left-radius:3px;border-top-right-radius:3px;border-bottom-right-radius:3px;border-bottom-left-radius:3px" title="Toggle Numbers" href="http://www.gamedev.net/topic/637167-how-to-receive-broadcast-and-reply-to-broadcast-sender-by-using-enet/#" target="_blank"></a></li>
<li style="PADDING-BOTTOM:0px;LIST-STYLE-TYPE:none;MARGIN:0px;PADDING-LEFT:0px;PADDING-RIGHT:0px;FLOAT:left;PADDING-TOP:0px"><a style="BORDER-BOTTOM:rgb(219,219,219) 1px solid;BORDER-LEFT:rgb(219,219,219) 1px solid;PADDING-BOTTOM:0px;LINE-HEIGHT:22px;MIN-HEIGHT:22px;PADDING-LEFT:10px;PADDING-RIGHT:10px;DISPLAY:inline-block;WHITE-SPACE:nowrap;min-height:22px;COLOR:rgb(97,97,97);MARGIN-LEFT:3px;FONT-SIZE:12px;BORDER-TOP:rgb(219,219,219) 1px solid;BORDER-RIGHT:rgb(219,219,219) 1px solid;PADDING-TOP:0px;border-top-left-radius:3px;border-top-right-radius:3px;border-bottom-right-radius:3px;border-bottom-left-radius:3px" title="Copy" href="http://www.gamedev.net/topic/637167-how-to-receive-broadcast-and-reply-to-broadcast-sender-by-using-enet/#" target="_blank">
<div style="PADDING-BOTTOM:0px;MARGIN:0px;PADDING-LEFT:0px;WIDTH:22px;PADDING-RIGHT:0px;min-height:24px;PADDING-TOP:0px"><u></u></div></a></li>
<li style="PADDING-BOTTOM:0px;LIST-STYLE-TYPE:none;MARGIN:0px;PADDING-LEFT:0px;PADDING-RIGHT:0px;FLOAT:left;PADDING-TOP:0px"><a style="BORDER-BOTTOM:rgb(219,219,219) 1px solid;BORDER-LEFT:rgb(219,219,219) 1px solid;PADDING-BOTTOM:0px;LINE-HEIGHT:22px;MIN-HEIGHT:22px;PADDING-LEFT:10px;PADDING-RIGHT:10px;DISPLAY:inline-block;WHITE-SPACE:nowrap;min-height:22px;COLOR:rgb(97,97,97);MARGIN-LEFT:3px;FONT-SIZE:12px;BORDER-TOP:rgb(219,219,219) 1px solid;BORDER-RIGHT:rgb(219,219,219) 1px solid;PADDING-TOP:0px;border-top-left-radius:3px;border-top-right-radius:3px;border-bottom-right-radius:3px;border-bottom-left-radius:3px" title="Print" href="http://www.gamedev.net/topic/637167-how-to-receive-broadcast-and-reply-to-broadcast-sender-by-using-enet/#" target="_blank"></a></li>
<li style="PADDING-BOTTOM:0px;LIST-STYLE-TYPE:none;MARGIN:0px;PADDING-LEFT:0px;PADDING-RIGHT:0px;FLOAT:left;PADDING-TOP:0px"></li></ul><pre style="BACKGROUND-IMAGE:none!important;BORDER-BOTTOM:rgb(201,201,201) 1px solid;TEXT-ALIGN:left!important;BORDER-LEFT:rgb(201,201,201) 1px solid;PADDING-BOTTOM:5px;LINE-HEIGHT:1.1em!important;MARGIN:0px;OUTLINE-STYLE:none!important;OUTLINE-COLOR:invert!important;MIN-HEIGHT:auto!important;PADDING-LEFT:5px;OUTLINE-WIDTH:0px!important;WIDTH:auto;PADDING-RIGHT:5px;FONT-FAMILY:'Courier New',Courier,monospace!important;FLOAT:none!important;min-height:auto!important;MAX-HEIGHT:450px;FONT-SIZE:1.1em!important;VERTICAL-ALIGN:baseline!important;OVERFLOW:auto;BORDER-TOP:rgb(201,201,201) 1px solid;FONT-WEIGHT:normal!important;BORDER-RIGHT:rgb(201,201,201) 1px solid;PADDING-TOP:5px;border-top-left-radius:0px;border-top-right-radius:0px;border-bottom-right-radius:0px;border-bottom-left-radius:0px">
<ol style="PADDING-BOTTOM:0px;LIST-STYLE-TYPE:decimal!important;MARGIN:0px;PADDING-LEFT:0px;PADDING-RIGHT:0px;COLOR:rgb(153,153,153)!important;PADDING-TOP:0px"><li style="LIST-STYLE-POSITION:inside;PADDING-BOTTOM:2px;LIST-STYLE-TYPE:none!important;MARGIN:0px;PADDING-LEFT:0px;PADDING-RIGHT:0px;PADDING-TOP:2px" value="1">
<span style="COLOR:rgb(0,102,153);FONT-WEIGHT:bold!important">void</span><span style="COLOR:rgb(0,0,0)"> scan_servers_by_send_broadcast</span><span style="COLOR:rgb(102,102,0)">()</span></li><li style="LIST-STYLE-POSITION:inside;PADDING-BOTTOM:2px;BACKGROUND-COLOR:rgb(252,252,252);LIST-STYLE-TYPE:none!important;MARGIN:0px;PADDING-LEFT:0px;PADDING-RIGHT:0px;PADDING-TOP:2px">
<span style="COLOR:rgb(102,102,0)">{</span></li><li style="LIST-STYLE-POSITION:inside;PADDING-BOTTOM:2px;LIST-STYLE-TYPE:none!important;MARGIN:0px;PADDING-LEFT:0px;PADDING-RIGHT:0px;PADDING-TOP:2px"><span style="COLOR:rgb(102,0,102)">ENETAddress</span><span style="COLOR:rgb(0,0,0)"> address</span><span style="COLOR:rgb(102,102,0)">;</span></li>
<li style="LIST-STYLE-POSITION:inside;PADDING-BOTTOM:2px;BACKGROUND-COLOR:rgb(252,252,252);LIST-STYLE-TYPE:none!important;MARGIN:0px;PADDING-LEFT:0px;PADDING-RIGHT:0px;PADDING-TOP:2px"><span style="COLOR:rgb(0,0,0)"> </span></li>
<li style="LIST-STYLE-POSITION:inside;PADDING-BOTTOM:2px;LIST-STYLE-TYPE:none!important;MARGIN:0px;PADDING-LEFT:0px;PADDING-RIGHT:0px;PADDING-TOP:2px"><span style="COLOR:rgb(0,0,0)"> </span></li><li style="LIST-STYLE-POSITION:inside;PADDING-BOTTOM:2px;BACKGROUND-COLOR:rgb(252,252,252);LIST-STYLE-TYPE:none!important;MARGIN:0px;PADDING-LEFT:0px;PADDING-RIGHT:0px;PADDING-TOP:2px">
<span style="COLOR:rgb(0,0,0)"> address</span><span style="COLOR:rgb(102,102,0)">.</span><span style="COLOR:rgb(0,0,0)">host </span><span style="COLOR:rgb(102,102,0)">=</span><span style="COLOR:rgb(0,0,0)"> ENET_HOST_BROADCAST</span><span style="COLOR:rgb(102,102,0)">;</span></li>
<li style="LIST-STYLE-POSITION:inside;PADDING-BOTTOM:2px;LIST-STYLE-TYPE:none!important;MARGIN:0px;PADDING-LEFT:0px;PADDING-RIGHT:0px;PADDING-TOP:2px"><span style="COLOR:rgb(0,0,0)"> address</span><span style="COLOR:rgb(102,102,0)">.</span><span style="COLOR:rgb(0,0,0)">port </span><span style="COLOR:rgb(102,102,0)">=</span><span style="COLOR:rgb(0,0,0)"> BROADCAST_PORT</span></li>
<li style="LIST-STYLE-POSITION:inside;PADDING-BOTTOM:2px;BACKGROUND-COLOR:rgb(252,252,252);LIST-STYLE-TYPE:none!important;MARGIN:0px;PADDING-LEFT:0px;PADDING-RIGHT:0px;PADDING-TOP:2px"><span style="COLOR:rgb(0,0,0)"> </span></li>
<li style="LIST-STYLE-POSITION:inside;PADDING-BOTTOM:2px;LIST-STYLE-TYPE:none!important;MARGIN:0px;PADDING-LEFT:0px;PADDING-RIGHT:0px;PADDING-TOP:2px"><span style="COLOR:rgb(0,0,0)"> </span></li><li style="LIST-STYLE-POSITION:inside;PADDING-BOTTOM:2px;BACKGROUND-COLOR:rgb(252,252,252);LIST-STYLE-TYPE:none!important;MARGIN:0px;PADDING-LEFT:0px;PADDING-RIGHT:0px;PADDING-TOP:2px">
<span style="COLOR:rgb(102,0,102)">ENETSocket</span><span style="COLOR:rgb(0,0,0)"> socket </span><span style="COLOR:rgb(102,102,0)">=</span><span style="COLOR:rgb(0,0,0)"> ENET_socket_create</span><span style="COLOR:rgb(102,102,0)">(</span><span style="COLOR:rgb(0,0,0)">ENET_SOCKET_TYPE_DATAGRAM</span><span style="COLOR:rgb(102,102,0)">);</span></li>
<li style="LIST-STYLE-POSITION:inside;PADDING-BOTTOM:2px;LIST-STYLE-TYPE:none!important;MARGIN:0px;PADDING-LEFT:0px;PADDING-RIGHT:0px;PADDING-TOP:2px"><span style="COLOR:rgb(0,0,0)">ENET_socket_set_option</span><span style="COLOR:rgb(102,102,0)">(</span><span style="COLOR:rgb(0,0,0)">socket</span><span style="COLOR:rgb(102,102,0)">,</span><span style="COLOR:rgb(0,0,0)">ENET_SOCKOPT_NONBLOCK</span><span style="COLOR:rgb(102,102,0)">,</span><span style="COLOR:rgb(0,102,102)">1</span><span style="COLOR:rgb(102,102,0)">);</span></li>
<li style="LIST-STYLE-POSITION:inside;PADDING-BOTTOM:2px;BACKGROUND-COLOR:rgb(252,252,252);LIST-STYLE-TYPE:none!important;MARGIN:0px;PADDING-LEFT:0px;PADDING-RIGHT:0px;PADDING-TOP:2px"><span style="COLOR:rgb(0,0,0)">ENET_socket_set_option</span><span style="COLOR:rgb(102,102,0)">(</span><span style="COLOR:rgb(0,0,0)">socket</span><span style="COLOR:rgb(102,102,0)">,</span><span style="COLOR:rgb(0,0,0)">ENET_SOCKOPT_BROADCAST</span><span style="COLOR:rgb(102,102,0)">,</span><span style="COLOR:rgb(0,102,102)">1</span><span style="COLOR:rgb(102,102,0)">);</span></li>
<li style="LIST-STYLE-POSITION:inside;PADDING-BOTTOM:2px;LIST-STYLE-TYPE:none!important;MARGIN:0px;PADDING-LEFT:0px;PADDING-RIGHT:0px;PADDING-TOP:2px"><span style="COLOR:rgb(0,0,0)"> </span></li><li style="LIST-STYLE-POSITION:inside;PADDING-BOTTOM:2px;BACKGROUND-COLOR:rgb(252,252,252);LIST-STYLE-TYPE:none!important;MARGIN:0px;PADDING-LEFT:0px;PADDING-RIGHT:0px;PADDING-TOP:2px">
<span style="COLOR:rgb(0,0,0)"> </span></li><li style="LIST-STYLE-POSITION:inside;PADDING-BOTTOM:2px;LIST-STYLE-TYPE:none!important;MARGIN:0px;PADDING-LEFT:0px;PADDING-RIGHT:0px;PADDING-TOP:2px"><span style="COLOR:rgb(0,0,0)">ENET_socket_send</span><span style="COLOR:rgb(102,102,0)">(</span><span style="COLOR:rgb(0,0,0)">socket</span><span style="COLOR:rgb(102,102,0)">,</span><span style="COLOR:rgb(0,0,0)">address</span><span style="COLOR:rgb(102,102,0)">,&</span><span style="COLOR:rgb(0,0,0)">broadcast_buf</span><span style="COLOR:rgb(102,102,0)">,</span><span style="COLOR:rgb(0,102,102)">1</span><span style="COLOR:rgb(102,102,0)">);</span></li>
<li style="LIST-STYLE-POSITION:inside;PADDING-BOTTOM:2px;BACKGROUND-COLOR:rgb(252,252,252);LIST-STYLE-TYPE:none!important;MARGIN:0px;PADDING-LEFT:0px;PADDING-RIGHT:0px;PADDING-TOP:2px"><span style="COLOR:rgb(0,0,0)">ENET_socket_destroy</span><span style="COLOR:rgb(102,102,0)">(</span><span style="COLOR:rgb(0,0,0)">socket</span><span style="COLOR:rgb(102,102,0)">);</span></li>
<li style="LIST-STYLE-POSITION:inside;PADDING-BOTTOM:2px;LIST-STYLE-TYPE:none!important;MARGIN:0px;PADDING-LEFT:0px;PADDING-RIGHT:0px;PADDING-TOP:2px"><span style="COLOR:rgb(102,102,0)">}</span></li></ol></pre></div>
<p style="PADDING-BOTTOM:0px;MARGIN:0px;PADDING-LEFT:0px;PADDING-RIGHT:0px;PADDING-TOP:0px"> </p></div>
<div style="TEXT-ALIGN:left;PADDING-BOTTOM:0px;TEXT-TRANSFORM:none;BACKGROUND-COLOR:rgb(250,251,252);TEXT-INDENT:0px;MARGIN:0px;PADDING-LEFT:0px;PADDING-RIGHT:0px;FONT:13px/20px helvetica,arial,verdana,tahoma,sans-serif;WHITE-SPACE:normal;LETTER-SPACING:normal;COLOR:rgb(40,40,40);WORD-SPACING:0px;PADDING-TOP:0px">
</div>
<div style="TEXT-ALIGN:left;PADDING-BOTTOM:0px;TEXT-TRANSFORM:none;BACKGROUND-COLOR:rgb(250,251,252);TEXT-INDENT:0px;MARGIN:0px;PADDING-LEFT:0px;PADDING-RIGHT:0px;FONT:13px/20px helvetica,arial,verdana,tahoma,sans-serif;WHITE-SPACE:normal;LETTER-SPACING:normal;COLOR:rgb(40,40,40);WORD-SPACING:0px;PADDING-TOP:0px">
servers:</div>
<div style="TEXT-ALIGN:left;PADDING-BOTTOM:0px;TEXT-TRANSFORM:none;BACKGROUND-COLOR:rgb(250,251,252);TEXT-INDENT:0px;MARGIN:0px;PADDING-LEFT:0px;PADDING-RIGHT:0px;FONT:13px/20px helvetica,arial,verdana,tahoma,sans-serif;WHITE-SPACE:normal;LETTER-SPACING:normal;COLOR:rgb(40,40,40);WORD-SPACING:0px;PADDING-TOP:0px">
-------------------------------------------------------------</div>
<div style="TEXT-ALIGN:left;PADDING-BOTTOM:0px;TEXT-TRANSFORM:none;BACKGROUND-COLOR:rgb(250,251,252);TEXT-INDENT:0px;MARGIN:0px;PADDING-LEFT:0px;PADDING-RIGHT:0px;FONT:13px/20px helvetica,arial,verdana,tahoma,sans-serif;WHITE-SPACE:normal;LETTER-SPACING:normal;COLOR:rgb(40,40,40);WORD-SPACING:0px;PADDING-TOP:0px">
[Q:
How can a server received broadcast information and tell client its ip address
?]</div>
<div style="TEXT-ALIGN:left;PADDING-BOTTOM:0px;TEXT-TRANSFORM:none;BACKGROUND-COLOR:rgb(250,251,252);TEXT-INDENT:0px;MARGIN:0px;PADDING-LEFT:0px;PADDING-RIGHT:0px;FONT:13px/20px helvetica,arial,verdana,tahoma,sans-serif;WHITE-SPACE:normal;LETTER-SPACING:normal;COLOR:rgb(40,40,40);WORD-SPACING:0px;PADDING-TOP:0px">
</div>
<div style="TEXT-ALIGN:left;PADDING-BOTTOM:0px;TEXT-TRANSFORM:none;BACKGROUND-COLOR:rgb(250,251,252);TEXT-INDENT:0px;MARGIN:0px;PADDING-LEFT:0px;PADDING-RIGHT:0px;FONT:13px/20px helvetica,arial,verdana,tahoma,sans-serif;WHITE-SPACE:normal;LETTER-SPACING:normal;COLOR:rgb(40,40,40);WORD-SPACING:0px;PADDING-TOP:0px">
<p style="PADDING-BOTTOM:0px;MARGIN:0px;PADDING-LEFT:0px;PADDING-RIGHT:0px;PADDING-TOP:0px"> </p>
<div style="PADDING-BOTTOM:0px;MARGIN:10px 0px;PADDING-LEFT:0px;WIDTH:1065px;PADDING-RIGHT:0px;PADDING-TOP:0px">
<ul style="LIST-STYLE:square none outside;PADDING-BOTTOM:0px;MARGIN:12px 0px 12px 40px;PADDING-LEFT:0px;PADDING-RIGHT:0px;PADDING-TOP:0px">
<li style="PADDING-BOTTOM:0px;LIST-STYLE-TYPE:none;MARGIN:0px;PADDING-LEFT:0px;PADDING-RIGHT:0px;FLOAT:left;PADDING-TOP:0px"><a style="BORDER-BOTTOM:rgb(219,219,219) 1px solid;BORDER-LEFT:rgb(219,219,219) 1px solid;PADDING-BOTTOM:0px;LINE-HEIGHT:22px;MIN-HEIGHT:22px;PADDING-LEFT:10px;PADDING-RIGHT:10px;DISPLAY:inline-block;WHITE-SPACE:nowrap;min-height:22px;COLOR:rgb(97,97,97);MARGIN-LEFT:3px;FONT-SIZE:12px;BORDER-TOP:rgb(219,219,219) 1px solid;BORDER-RIGHT:rgb(219,219,219) 1px solid;PADDING-TOP:0px;border-top-left-radius:3px;border-top-right-radius:3px;border-bottom-right-radius:3px;border-bottom-left-radius:3px" title="View Code" href="http://www.gamedev.net/topic/637167-how-to-receive-broadcast-and-reply-to-broadcast-sender-by-using-enet/#" target="_blank"></a></li>
<li style="PADDING-BOTTOM:0px;LIST-STYLE-TYPE:none;MARGIN:0px;PADDING-LEFT:0px;PADDING-RIGHT:0px;FLOAT:left;PADDING-TOP:0px"><a style="BORDER-BOTTOM:rgb(219,219,219) 1px solid;BORDER-LEFT:rgb(219,219,219) 1px solid;PADDING-BOTTOM:0px;LINE-HEIGHT:22px;MIN-HEIGHT:22px;PADDING-LEFT:10px;PADDING-RIGHT:10px;DISPLAY:inline-block;WHITE-SPACE:nowrap;min-height:22px;COLOR:rgb(97,97,97);MARGIN-LEFT:3px;FONT-SIZE:12px;BORDER-TOP:rgb(219,219,219) 1px solid;BORDER-RIGHT:rgb(219,219,219) 1px solid;PADDING-TOP:0px;border-top-left-radius:3px;border-top-right-radius:3px;border-bottom-right-radius:3px;border-bottom-left-radius:3px" title="Toggle Numbers" href="http://www.gamedev.net/topic/637167-how-to-receive-broadcast-and-reply-to-broadcast-sender-by-using-enet/#" target="_blank"></a></li>
<li style="PADDING-BOTTOM:0px;LIST-STYLE-TYPE:none;MARGIN:0px;PADDING-LEFT:0px;PADDING-RIGHT:0px;FLOAT:left;PADDING-TOP:0px"><a style="BORDER-BOTTOM:rgb(219,219,219) 1px solid;BORDER-LEFT:rgb(219,219,219) 1px solid;PADDING-BOTTOM:0px;LINE-HEIGHT:22px;MIN-HEIGHT:22px;PADDING-LEFT:10px;PADDING-RIGHT:10px;DISPLAY:inline-block;WHITE-SPACE:nowrap;min-height:22px;COLOR:rgb(97,97,97);MARGIN-LEFT:3px;FONT-SIZE:12px;BORDER-TOP:rgb(219,219,219) 1px solid;BORDER-RIGHT:rgb(219,219,219) 1px solid;PADDING-TOP:0px;border-top-left-radius:3px;border-top-right-radius:3px;border-bottom-right-radius:3px;border-bottom-left-radius:3px" title="Copy" href="http://www.gamedev.net/topic/637167-how-to-receive-broadcast-and-reply-to-broadcast-sender-by-using-enet/#" target="_blank">
<div style="PADDING-BOTTOM:0px;MARGIN:0px;PADDING-LEFT:0px;WIDTH:22px;PADDING-RIGHT:0px;min-height:24px;PADDING-TOP:0px"><u></u></div></a></li>
<li style="PADDING-BOTTOM:0px;LIST-STYLE-TYPE:none;MARGIN:0px;PADDING-LEFT:0px;PADDING-RIGHT:0px;FLOAT:left;PADDING-TOP:0px"><a style="BORDER-BOTTOM:rgb(219,219,219) 1px solid;BORDER-LEFT:rgb(219,219,219) 1px solid;PADDING-BOTTOM:0px;LINE-HEIGHT:22px;MIN-HEIGHT:22px;PADDING-LEFT:10px;PADDING-RIGHT:10px;DISPLAY:inline-block;WHITE-SPACE:nowrap;min-height:22px;COLOR:rgb(97,97,97);MARGIN-LEFT:3px;FONT-SIZE:12px;BORDER-TOP:rgb(219,219,219) 1px solid;BORDER-RIGHT:rgb(219,219,219) 1px solid;PADDING-TOP:0px;border-top-left-radius:3px;border-top-right-radius:3px;border-bottom-right-radius:3px;border-bottom-left-radius:3px" title="Print" href="http://www.gamedev.net/topic/637167-how-to-receive-broadcast-and-reply-to-broadcast-sender-by-using-enet/#" target="_blank"></a></li>
<li style="PADDING-BOTTOM:0px;LIST-STYLE-TYPE:none;MARGIN:0px;PADDING-LEFT:0px;PADDING-RIGHT:0px;FLOAT:left;PADDING-TOP:0px"></li></ul><pre style="BACKGROUND-IMAGE:none!important;BORDER-BOTTOM:rgb(201,201,201) 1px solid;TEXT-ALIGN:left!important;BORDER-LEFT:rgb(201,201,201) 1px solid;PADDING-BOTTOM:5px;LINE-HEIGHT:1.1em!important;MARGIN:0px;OUTLINE-STYLE:none!important;OUTLINE-COLOR:invert!important;MIN-HEIGHT:auto!important;PADDING-LEFT:5px;OUTLINE-WIDTH:0px!important;WIDTH:auto;PADDING-RIGHT:5px;FONT-FAMILY:'Courier New',Courier,monospace!important;FLOAT:none!important;min-height:auto!important;MAX-HEIGHT:450px;FONT-SIZE:1.1em!important;VERTICAL-ALIGN:baseline!important;OVERFLOW:auto;BORDER-TOP:rgb(201,201,201) 1px solid;FONT-WEIGHT:normal!important;BORDER-RIGHT:rgb(201,201,201) 1px solid;PADDING-TOP:5px;border-top-left-radius:0px;border-top-right-radius:0px;border-bottom-right-radius:0px;border-bottom-left-radius:0px">
<ol style="PADDING-BOTTOM:0px;LIST-STYLE-TYPE:decimal!important;MARGIN:0px;PADDING-LEFT:0px;PADDING-RIGHT:0px;COLOR:rgb(153,153,153)!important;PADDING-TOP:0px"><li style="LIST-STYLE-POSITION:inside;PADDING-BOTTOM:2px;LIST-STYLE-TYPE:none!important;MARGIN:0px;PADDING-LEFT:0px;PADDING-RIGHT:0px;PADDING-TOP:2px" value="1">
<span style="COLOR:rgb(102,0,102)">ENETSocket</span><span style="COLOR:rgb(0,0,0)"> socket </span><span style="COLOR:rgb(102,102,0)">=</span><span style="COLOR:rgb(0,0,0)"> ENET_socket_create</span><span style="COLOR:rgb(102,102,0)">(</span><span style="COLOR:rgb(0,0,0)">ENET_SOCKET_TYPE_DATAGRAM</span><span style="COLOR:rgb(102,102,0)">);</span></li>
<li style="LIST-STYLE-POSITION:inside;PADDING-BOTTOM:2px;BACKGROUND-COLOR:rgb(252,252,252);LIST-STYLE-TYPE:none!important;MARGIN:0px;PADDING-LEFT:0px;PADDING-RIGHT:0px;PADDING-TOP:2px"><span style="COLOR:rgb(0,0,0)">ENET_socket_set_option</span><span style="COLOR:rgb(102,102,0)">(</span><span style="COLOR:rgb(0,0,0)">socket</span><span style="COLOR:rgb(102,102,0)">,</span><span style="COLOR:rgb(0,0,0)">ENET_SOCKOPT_NONBLOCK</span><span style="COLOR:rgb(102,102,0)">,</span><span style="COLOR:rgb(0,102,102)">1</span><span style="COLOR:rgb(102,102,0)">);</span></li>
<li style="LIST-STYLE-POSITION:inside;PADDING-BOTTOM:2px;LIST-STYLE-TYPE:none!important;MARGIN:0px;PADDING-LEFT:0px;PADDING-RIGHT:0px;PADDING-TOP:2px"><span style="COLOR:rgb(0,0,0)">ENET_socket_set_option</span><span style="COLOR:rgb(102,102,0)">(</span><span style="COLOR:rgb(0,0,0)">socket</span><span style="COLOR:rgb(102,102,0)">,</span><span style="COLOR:rgb(0,0,0)">ENET_SOCKOPT_REUSEADDR</span><span style="COLOR:rgb(102,102,0)">,</span><span style="COLOR:rgb(0,102,102)">1</span><span style="COLOR:rgb(102,102,0)">);</span></li>
<li style="LIST-STYLE-POSITION:inside;PADDING-BOTTOM:2px;BACKGROUND-COLOR:rgb(252,252,252);LIST-STYLE-TYPE:none!important;MARGIN:0px;PADDING-LEFT:0px;PADDING-RIGHT:0px;PADDING-TOP:2px"><span style="COLOR:rgb(0,0,0)">ENET_socket_set_option</span><span style="COLOR:rgb(102,102,0)">(</span><span style="COLOR:rgb(0,0,0)">socket</span><span style="COLOR:rgb(102,102,0)">,</span><span style="COLOR:rgb(0,0,0)">ENET_SOCKOPT_BROADCAST</span><span style="COLOR:rgb(102,102,0)">,</span><span style="COLOR:rgb(0,102,102)">1</span><span style="COLOR:rgb(102,102,0)">);</span></li>
<li style="LIST-STYLE-POSITION:inside;PADDING-BOTTOM:2px;LIST-STYLE-TYPE:none!important;MARGIN:0px;PADDING-LEFT:0px;PADDING-RIGHT:0px;PADDING-TOP:2px"><span style="COLOR:rgb(0,0,0)"> </span></li><li style="LIST-STYLE-POSITION:inside;PADDING-BOTTOM:2px;BACKGROUND-COLOR:rgb(252,252,252);LIST-STYLE-TYPE:none!important;MARGIN:0px;PADDING-LEFT:0px;PADDING-RIGHT:0px;PADDING-TOP:2px">
<span style="COLOR:rgb(0,0,0)"> </span></li><li style="LIST-STYLE-POSITION:inside;PADDING-BOTTOM:2px;LIST-STYLE-TYPE:none!important;MARGIN:0px;PADDING-LEFT:0px;PADDING-RIGHT:0px;PADDING-TOP:2px"><span style="COLOR:rgb(102,0,102)">ENETAddress</span><span style="COLOR:rgb(0,0,0)"> serv_addr</span><span style="COLOR:rgb(102,102,0)">;</span></li>
<li style="LIST-STYLE-POSITION:inside;PADDING-BOTTOM:2px;BACKGROUND-COLOR:rgb(252,252,252);LIST-STYLE-TYPE:none!important;MARGIN:0px;PADDING-LEFT:0px;PADDING-RIGHT:0px;PADDING-TOP:2px"><span style="COLOR:rgb(0,0,0)"> serv_addr</span><span style="COLOR:rgb(102,102,0)">.</span><span style="COLOR:rgb(0,0,0)">host</span><span style="COLOR:rgb(102,102,0)">=</span><span style="COLOR:rgb(0,0,0)">ENET_HOST_ANY</span><span style="COLOR:rgb(102,102,0)">;</span></li>
<li style="LIST-STYLE-POSITION:inside;PADDING-BOTTOM:2px;LIST-STYLE-TYPE:none!important;MARGIN:0px;PADDING-LEFT:0px;PADDING-RIGHT:0px;PADDING-TOP:2px"><span style="COLOR:rgb(0,0,0)"> serv_addr</span><span style="COLOR:rgb(102,102,0)">.</span><span style="COLOR:rgb(0,0,0)">port</span><span style="COLOR:rgb(102,102,0)">=</span><span style="COLOR:rgb(0,0,0)">BROADCAST_PORT</span><span style="COLOR:rgb(102,102,0)">;</span><span style="COLOR:rgb(0,0,0)"> </span><span style="COLOR:rgb(0,130,0)!important">// IS THIS RIGHT?</span></li>
<li style="LIST-STYLE-POSITION:inside;PADDING-BOTTOM:2px;BACKGROUND-COLOR:rgb(252,252,252);LIST-STYLE-TYPE:none!important;MARGIN:0px;PADDING-LEFT:0px;PADDING-RIGHT:0px;PADDING-TOP:2px"><span style="COLOR:rgb(0,0,0)">ENET_socket_bind</span><span style="COLOR:rgb(102,102,0)">(</span><span style="COLOR:rgb(0,0,0)">socket</span><span style="COLOR:rgb(102,102,0)">,&</span><span style="COLOR:rgb(0,0,0)">serv_addr</span><span style="COLOR:rgb(102,102,0)">);</span></li>
<li style="LIST-STYLE-POSITION:inside;PADDING-BOTTOM:2px;LIST-STYLE-TYPE:none!important;MARGIN:0px;PADDING-LEFT:0px;PADDING-RIGHT:0px;PADDING-TOP:2px"><span style="COLOR:rgb(102,102,0)">...........</span></li></ol></pre></div>
<p style="PADDING-BOTTOM:0px;MARGIN:0px;PADDING-LEFT:0px;PADDING-RIGHT:0px;PADDING-TOP:0px"> </p></div>
<div style="TEXT-ALIGN:left;PADDING-BOTTOM:0px;TEXT-TRANSFORM:none;BACKGROUND-COLOR:rgb(250,251,252);TEXT-INDENT:0px;MARGIN:0px;PADDING-LEFT:0px;PADDING-RIGHT:0px;FONT:13px/20px helvetica,arial,verdana,tahoma,sans-serif;WHITE-SPACE:normal;LETTER-SPACING:normal;COLOR:rgb(40,40,40);WORD-SPACING:0px;PADDING-TOP:0px">
I
DON'T KNOW WHAT SHOULD DO AFTER BINDING,,,,, HELP ME PLEASE
,THANKS/...</div>
<div style="TEXT-ALIGN:left;PADDING-BOTTOM:0px;TEXT-TRANSFORM:none;BACKGROUND-COLOR:rgb(250,251,252);TEXT-INDENT:0px;MARGIN:0px;PADDING-LEFT:0px;PADDING-RIGHT:0px;FONT:13px/20px helvetica,arial,verdana,tahoma,sans-serif;WHITE-SPACE:normal;LETTER-SPACING:normal;COLOR:rgb(40,40,40);WORD-SPACING:0px;PADDING-TOP:0px">
</div>
<div style="TEXT-ALIGN:left;PADDING-BOTTOM:0px;TEXT-TRANSFORM:none;BACKGROUND-COLOR:rgb(250,251,252);TEXT-INDENT:0px;MARGIN:0px;PADDING-LEFT:0px;PADDING-RIGHT:0px;FONT:13px/20px helvetica,arial,verdana,tahoma,sans-serif;WHITE-SPACE:normal;LETTER-SPACING:normal;COLOR:rgb(40,40,40);WORD-SPACING:0px;PADDING-TOP:0px">
any
more, does BROADCAST_PORT shold be different from the SERVER_MAIN_SERVICE_PORT
?</div></div>
<br>_______________________________________________<br>
ENet-discuss mailing list<br>
<a href="mailto:ENet-discuss@cubik.org">ENet-discuss@cubik.org</a><br>
<a href="http://lists.cubik.org/mailman/listinfo/enet-discuss" target="_blank">http://lists.cubik.org/mailman/listinfo/enet-discuss</a><br>
<br></blockquote></div><br></div></div>