UDP Broadcast problem

  • Thread starter Mark van Heeswijk
  • Start date
M

Mark van Heeswijk

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
 
P

Peter van Merkerk

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 )
);
---------------------------------------------------------------------- ------

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
 
M

Mark van Heeswijk

Oops, sorry...

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

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,755
Messages
2,569,537
Members
45,021
Latest member
AkilahJaim

Latest Threads

Top