Connect with Facebook Lost Password?


Go Back   CodeCall Programming Forum > Software Development > C and C++

C and C++ C and C++ forum for discussing all forms of C except for C#. These languages are powerful low level languages used for creating Operating Systems, Device Drivers, compilers and much more.

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 05-02-2008, 06:28 PM
Newbie
 
Join Date: Jan 2008
Posts: 27
Rep Power: 0
mholt is an unknown quantity at this point
Question Winsock: Receiving UDP broadcasts

I have successfully set up a UDP server, a UDP client, and am able to get them communicating one-on-one.

However, sending a message to all clients (is that the same as "broadcasting"? - the clients may not be on the same LAN, necessarily) - is not working.

EDIT: Okay, well, using SmartSniff I see that when the server sends a broadcasted UDP message, it goes to IP address 255.255.255.255. It's sending correctly but the client is not reading it. But wouldn't that send the message to only computers on a LAN, or does it go to all connected clients?

Either way, for small packet sizes (each less than 50 or 100 bytes), would it be okay to store each client's address in a container then loop through it and send each message individually?

What's the best way to send and receive UDP messages on a larger scale like this? (Being one server sending to many connected clients.)

Thanks!
-Matt


Another Edit: I did some more research and see that "multicasting" may be an option. However it looks like it has some restrictions... so how should I do this?

Last edited by mholt; 05-02-2008 at 10:50 PM..
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #2 (permalink)  
Old 05-04-2008, 12:45 AM
Newbie
 
Join Date: Jan 2008
Posts: 27
Rep Power: 0
mholt is an unknown quantity at this point
Default Re: Winsock: Receiving UDP broadcasts

Okay, well after some experimentation, I'm noticing that since my packets are small (under 50 bytes), it doesn't take much time to send/recv a set to and from each client. I've decided to just use a for loop through a vector of client addresses.

If somebody has a better way, please enlighten me. Thanks
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #3 (permalink)  
Old 05-04-2008, 10:02 AM
Xav's Avatar   
Xav Xav is offline
Code Slinger
 
Join Date: Mar 2008
Location: The North Pole
Posts: 13,210
Blog Entries: 13
Rep Power: 105
Xav has much to be proud ofXav has much to be proud ofXav has much to be proud ofXav has much to be proud ofXav has much to be proud ofXav has much to be proud ofXav has much to be proud ofXav has much to be proud ofXav has much to be proud of
Send a message via MSN to Xav
Default Re: Winsock: Receiving UDP broadcasts

If you've found a solution that works, that's great.
__________________

Quote:
Originally Posted by Jordan View Post
Good members, like yourself, stick around and post for ages to come!
Mr. Xav | Blog | Forums
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Reply

Tags
broadcast, c++, recvfrom, udp, winsock



Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

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 On


Similar Threads
Thread Thread Starter Forum Replies Last Post
[Request] winsock wazofski General Programming 0 03-10-2008 12:40 PM


All times are GMT -5. The time now is 08:13 PM.

Freelance Jobs

XML/XSL: Need code for Book with Chapers using XML
Create an XML file for a book of your creation, and a basic CSS file that will format it to display ...
Earn: $40.00


C++/C: Simple firework cue sequencer
What I require is a rework of a simple cue sequencer. I have a piece of hardware (an Arduino boar...
Earn: $50.00


HTML/XHTML: Menu Rework - ASCIIBin
I'm placing this in the HTML/XHTML section of the Freelance site but you are not limited to HTML. Wh...
Earn: $20.00



CodeCall Goal

Goal #1: 1,000 Blogs
Goal #2: 1,000 Wiki Pages
Goal #3: 300,000 Posts
Goal #4: 20,000 Threads
Done: 30%, 23%, 55%, 75%

Ads