UDP Broadcast problem

  • Follow


Hi all,

currently i'm working on a  client-server application...
when doing an UDP-broadcast the packet is received ok, at the other side,
but for some reason after that
_ANOTHER_ packet is received that has source-address 255.255.255.255, which
i didn't send.

This packet generates an error when received :( :
error 10054 - connection reset by peer

below is what i use to receive, and the piece of code to set the options:
----------------------------------------------------------------------------
--------------------------------------------
recvfrom( GlobalSocket, tempBuff, sizeof(tempBuff), (int)NULL,  (SOCKADDR
*)&remote_sockaddr_in,(int *)  )
----------------------------------------------------------------------------
--------------------------------------------
&remote_sockaddr_length);
//ENABLE BROADCAST
  BOOL fBroadcast = TRUE;
  int err = setsockopt ( GlobalSocket,
                SOL_SOCKET,
                SO_BROADCAST,
                (CHAR *) &fBroadcast,
                sizeof ( BOOL )
                );
----------------------------------------------------------------------------
--------------------------------------------


Is anybody familiar with this? What could be causing this?

Thanks in advance,
Mark


0
Reply news2217 (3) 9/1/2003 3:11:32 PM

> currently i'm working on a  client-server application...
> when doing an UDP-broadcast the packet is received ok, at the other
side,
> but for some reason after that
> _ANOTHER_ packet is received that has source-address 255.255.255.255,
which
> i didn't send.
>
> This packet generates an error when received :( :
> error 10054 - connection reset by peer
>
> below is what i use to receive, and the piece of code to set the
options:
> ----------------------------------------------------------------------
------
> --------------------------------------------
> recvfrom( GlobalSocket, tempBuff, sizeof(tempBuff), (int)NULL,
(SOCKADDR
> *)&remote_sockaddr_in,(int *)  )
> ----------------------------------------------------------------------
------
> --------------------------------------------
> &remote_sockaddr_length);
> file://ENABLE BROADCAST
>   BOOL fBroadcast = TRUE;
>   int err = setsockopt ( GlobalSocket,
>                 SOL_SOCKET,
>                 SO_BROADCAST,
>                 (CHAR *) &fBroadcast,
>                 sizeof ( BOOL )
>                 );
> ----------------------------------------------------------------------
------
> --------------------------------------------
> Is anybody familiar with this? What could be causing this?

Standard C++ has no support for socket communication, hence your
question is off-topic here. For suggestions were to post read this
http://home.wanadoo.nl/efx/c++-faq/how-to-post.html#faq-5.9 and this
http://www.slack.net/~shiva/welcome.txt

--
Peter van Merkerk
peter.van.merkerk(at)dse.nl


0
Reply merkerk (462) 9/1/2003 3:34:04 PM


Oops, sorry...

Anyway...problem is solved now....seems that the packets where too long :s

"Peter van Merkerk" <merkerk@deadspam.com> wrote in message
news:bivp0l$dp5lc$1@ID-133164.news.uni-berlin.de...
> > currently i'm working on a  client-server application...
> > when doing an UDP-broadcast the packet is received ok, at the other
> side,
> > but for some reason after that
> > _ANOTHER_ packet is received that has source-address 255.255.255.255,
> which
> > i didn't send.
> >
> > This packet generates an error when received :( :
> > error 10054 - connection reset by peer
> >
> > below is what i use to receive, and the piece of code to set the
> options:
> > ----------------------------------------------------------------------
> ------
> > --------------------------------------------
> > recvfrom( GlobalSocket, tempBuff, sizeof(tempBuff), (int)NULL,
> (SOCKADDR
> > *)&remote_sockaddr_in,(int *)  )
> > ----------------------------------------------------------------------
> ------
> > --------------------------------------------
> > &remote_sockaddr_length);
> > file://ENABLE BROADCAST
> >   BOOL fBroadcast = TRUE;
> >   int err = setsockopt ( GlobalSocket,
> >                 SOL_SOCKET,
> >                 SO_BROADCAST,
> >                 (CHAR *) &fBroadcast,
> >                 sizeof ( BOOL )
> >                 );
> > ----------------------------------------------------------------------
> ------
> > --------------------------------------------
> > Is anybody familiar with this? What could be causing this?
>
> Standard C++ has no support for socket communication, hence your
> question is off-topic here. For suggestions were to post read this
> http://home.wanadoo.nl/efx/c++-faq/how-to-post.html#faq-5.9 and this
> http://www.slack.net/~shiva/welcome.txt
>
> --
> Peter van Merkerk
> peter.van.merkerk(at)dse.nl
>
>


0
Reply news2217 (3) 9/1/2003 4:10:20 PM

2 Replies
147 Views

(page loaded in 0.025 seconds)

Similiar Articles:













7/25/2012 12:50:22 AM


Reply: