[muscle] Re: peer-to-peer help intro

  • From: barry brant <bacondog835710@xxxxxxxxx>
  • To: muscle@xxxxxxxxxxxxx
  • Date: Sat, 30 Apr 2005 21:20:52 -0700 (PDT)

Thanks for the fast reply Jeremy!  

I am writing in C++ and though I learned it in
university, it's been quite a number of years since
I've touched it.  I'm writing for Win32, and for my
first project I want to do a simple chat app
(peer-to-peer) where the IP addresses of both chat
clients are already known.

So I looked at BeShareAndMuscle.html and based on
that, viewed class Win32MessageTransceiverThread from
the API.  It seems method AddNewConnectSession() will
connect to the IP and port of the other MUSCLE client
I want to do peer-to-peer with, then I can get any
messages by looping for events through
GetNextEventFromInternalThread().  The event code will
tell me whether I have a Message object.  For sending
messages, plainTextClient.cpp shows a method
"sendOutgoingMessage()" of MessageTransceiverThread
but I can't find that in the API.  What do I do to
send a message?

For what I want to do, I can't believe it's this easy.

One fundamental question I have is, is the same code
used for peer-to-peer as for client-server using
muscled?  That is, instead of connecting directly to
your client in peer-to-peer, connect instead to the
server, pattern-match nodes for who to send to, but
then get or send messages in the same way.  Is that
right?

What about client-server with subscriptions?  The
Beginner's guide mentions how to set one up, but
doesn't mention how to subscribe.

Are there some full samples of peer-to-peer and
client-server that I can study?  I couldn't find any.

I hope my questions aren't too ignorant... but I do
appreciate the help.

--- Jeremy Friesner <jaf@xxxxxxxxxxxx> wrote:
> Hi Barry,
> 
> I'm not sure exactly what you have in mind -- MUSCLE
> doesn't have a ready-made "peer-to-peer API", but it
> does have the tools to make it easier to construct a
> peer-to-peer system.  Those tools include:
> 
> 1) A central server (muscled) that can be used as a
> starting point... i.e. your clients can log in to
> the server to find out the IP addresses of other
> participating clients, and then use those IP
> addresses to contact the other clients directly
> 
> 2) A message thread class (MessageTransceiverThread)
> that hides most of the networking details and lets
> you do peer-to-peer communication at a higher level
> (i.e. sending and receiving Message objects instead
> of byte streams, thereby avoiding the hassles of
> message fragmentation/reassembly, byte-gender,
> protocol extension, and other common pitfalls)
> 
> 3) Lower-level APIs such as the MessageIOGateway
> class and the simplified networking API  functions
> in NetworkUtilityFunctions.cpp that let your code
> handle the basic networking tasks directly if you
> prefer not to have a separate I/O thread handle them
> on your behalf.
> 
> Let me know what it is you have in mind (i.e. what
> sort of application you want to create, what
> operating system(s) you want it to run on, what
> programming language(s) you want to write it in,
> etc) and I may be able to give you more specific
> help.
> 
> As for examples, here are two:
> 
> BeShare -- a Napster style file sharing program for
> BeOS (includes source code) 
>   
>
http://www.lcscanada.com/muscle/BeShareAndMuscle.html
>   (magazine article)
>    http://www.lcscanada.com/jaf/beshare/index.html 
> (Web page)
>   
> http://www.lcscanada.com/jaf/beshare/BeShare2.27.zip
> (source and BeOS executables)
> 
> FoxRabbitCarrot -- a very simple multiplayer game
> written using Qt, so it runs on Windows, Mac, and
> Linux.  The code is a bit out of date and the game
> isn't all that much fun, but it should do for an
> example.
>   
> http://www.osnews.com/story.php=3Fnews=5Fid=3D1523  
>        (magazine article)
>   
>
http://www.lcscanada.com/jaf/FRC1.00b=5Fsource.tar.gz
>  (source code)
>   
> http://www.lcscanada.com/jaf/FRC1.00b=5FOSX.tar.gz  
>   (MacOS/X build)
>   
> http://www.lcscanada.com/jaf/FRC1.00b=5FRHat.tar.gz 
>    (Red Hat build)
>    http://www.lcscanada.com/jaf/FRC1.00b=5FWin.zip  
>          (Windows build)
> 
> -Jeremy
> 
> > I've looked at the beginner's guide, the API, and
> > searched through the "test" folder for how to do
> > peer-to-peer calls.  Can someone please point me
> to
> > the direction I need to be looking in terms of
> how-to
> > or maybe a sample=3F  
> 
> 
> 
> 


                
__________________________________ 
Do you Yahoo!? 
Yahoo! Small Business - Try our new resources site!
http://smallbusiness.yahoo.com/resources/ 

Other related posts: