Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > C++ > UDP Broadcast problem

Reply
Thread Tools

UDP Broadcast problem

 
 
Mark van Heeswijk
Guest
Posts: n/a
 
      09-01-2003
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


 
Reply With Quote
 
 
 
 
Peter van Merkerk
Guest
Posts: n/a
 
      09-01-2003
> 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/h...t.html#faq-5.9 and this
http://www.slack.net/~shiva/welcome.txt

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


 
Reply With Quote
 
 
 
 
Mark van Heeswijk
Guest
Posts: n/a
 
      09-01-2003
Oops, sorry...

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

"Peter van Merkerk" <> wrote in message
news:bivp0l$dp5lc$...
> > 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/h...t.html#faq-5.9 and this
> http://www.slack.net/~shiva/welcome.txt
>
> --
> Peter van Merkerk
> peter.van.merkerk(at)dse.nl
>
>



 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Problem receiving UDP broadcast packets. Grant Edwards Python 34 04-21-2011 02:22 PM
[offtopic?] problem with UDP broadcast on Windows XP Irmen de Jong Python 9 04-11-2007 12:08 AM
UDP broadcast does not work to loopback device without network connection? franklin.bowen@gmail.com Java 3 03-15-2006 08:20 PM
UDP broadcast does not work to loopback device without network connection? franklin.bowen@gmail.com Java 0 03-14-2006 09:27 AM
UDP broadcast problem LinuxGuy C++ 3 01-24-2006 05:17 PM



Advertisments
 



1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57