LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices


Reply
  Search this Thread
Old 04-09-2009, 03:59 AM   #1
vigneshinbox
LQ Newbie
 
Registered: Mar 2009
Posts: 19

Rep: Reputation: 0
How to broadcast and recieve a messaage in a Cluster?


I am designing a system which will broadcast a message to all the nodes in a cluster.And the receiving node should send a feed back to the broadcasting node.When i get a single feedback from any of the receiving node, the broadcasting node should stop receiving the feedback.With that feedback i am doing some operations.This both actions should be implemented in a single program.As i am new to socket programming i don't know how to do tat.Can someone give me the code for this???
Thanx in advance
 
Old 04-09-2009, 09:17 PM   #2
dwhitney67
Senior Member
 
Registered: Jun 2006
Location: Maryland
Distribution: Kubuntu, Fedora, RHEL
Posts: 1,541

Rep: Reputation: 335Reputation: 335Reputation: 335Reputation: 335
You should buy this book: http://www.kohala.com/start/unpv22e/unpv22e.html

Also on that page, is a link to the source code provided in the book. You should hopefully be able to find your answers there.

P.S. An example of a broadcaster and a receiver
Code:
#include <Socket/UDPSocket.h>

int main()
{
  socketpp::UDPSocket sock;
  sock.EnableBroadcast();
  sock.Send("hello world", 11, "255.255.255.255", 8000);
}
Code:
#include <Socket/UDPSocket.h>
#include <iostream>

int main()
{
  socketpp::UDPSocket sock;
  sock.Bind(8000);
  char msg[80] = {0};
  sock.Recv(msg, sizeof(msg) - 1);
  std::cout << msg << std::endl;
}

Last edited by dwhitney67; 04-10-2009 at 06:03 PM.
 
  


Reply



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 Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
LXer: Cray to Resell Moab Cluster Suite from Cluster Resources LXer Syndicated Linux News 0 02-04-2008 06:10 PM
Cluster accounting failed at 135593 (0x211a9): missing cluster in $Bitmap fakie_flip Linux - Software 1 01-02-2008 03:08 AM
LXer: Cluster Programming: Explicit Implications of Cluster Computing LXer Syndicated Linux News 0 12-26-2006 08:54 PM
LXer: Hitting the Cluster Wall - A Study in Cluster Optimization LXer Syndicated Linux News 0 06-27-2006 12:33 PM
LXer: Life, The Universe, and Your Cluster - A Study in Cluster Optimization LXer Syndicated Linux News 0 05-08-2006 08:54 AM

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 07:35 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration