[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index] [Thread Index]
[Monthly Archives] [List Home]

Re: AW: [Virtools] Implementation of a Client/Server building block



Actually, the best place to create the threads is in a manager (look at the
fllor manager for instance) object instead of a building block,
and use the building blocks for message passing and the like. Managers are sort
of "global" entities, and you can tell when the
user resets the scene, pauses, plays, etc... Maybe someone else has ideas as
well.

Robert Praxmarer wrote:

> Hi,
> threading works, but if I stop the nemo app, and remove the link which
> starts my building block, the thread is still running. Maybe I am doing
> something wrong and have implemented it in a wrong way.
> Here's what my code is about, it just starts a thread which sets a output to
> 0/1 and from 1/0 all the time.
> Would be nice if anyone could tell me if this is the right place to put a
> thread to.
>
> ..
> od->SetCreationFunction(CreateClientServerBehaviorProto);
> ..
>
> This is my creation function:
> int ClientServer(CKBehavior *beh,int deltat)
> {
>         static serverInit=false;
>
>         // Start TCP/IP server thtread
>
>         if(serverInit==false)
>         {
>                 serverInit=true;
>                 AfxBeginThread(TCPServer, beh, THREAD_PRIORITY_NORMAL);
>         }
>
>         beh->ActivateInput(0,FALSE);
>         beh->ActivateOutput(0,TRUE);
>         return CKBR_OK;
> }
>
> UINT TCPServer(LPVOID pParam)
> {
>         int val=0;
>         while(1)
>         {
>                 val=!val;
>                 ((CKBehavior *)(pParam))->SetOutputParameterValue(1,&val);
>         }
>         return 0;
> }
>
> -----Ursprüngliche Nachricht-----
> Von: Rob Pringle [mailto:robert.pringle@sympatico.ca]
> Gesendet: Freitag, 23. Februar 2001 07:03
> An: Robert Praxmarer
> Cc: virtools-user-group@lists.theswapmeet.com
> Betreff: Re: [Virtools] Implementation of a Client/Server building block
>
> What you're proposing certainly can be done. I've implemented something
> tihis
> already (client/server threadbased UDP/TCP building blocks) and it works
> beautifully.
> Nemo has no problems with it as long as you implement it correctly. I broke
> down the
> communication pipeline into a small series of blocks to get the necessary
> control that you
> need for games but it all depends on your needs.
>
> Good luck,
> Rob
>
> Robert Praxmarer wrote:
>
> > Hi,
> > We want to implement a building block for bidirectional TCP/IP
> > communication.
> > Therefor we need a building block which serves as a server and client.
> > My question is regarding the server. The server has to run as a thread,
> and
> > I want to know if there could occure problems with Nemo.
> > Maybe someone had to deal with the same subject and has already done such
> a
> > communication block, which is able to send and receive TCP/IP data.
> >
> > Best regards,
> > cubic
> >
> > Virtual Reality Integrator
> > @ Ars Electronica Futurlab
> >   Linz Austria
> >
> > ...............................................................
> > Distributed via the virtools-user-group list:
> http://www.theswapmeet.com/numl.html
> > To reply to the list instead of its author, use "Reply to All"
> > To unsubscribe: send "unsubscribe virtools-user-group" to
> Majordomo@lists.theswapmeet.com
> > To subscribe: send "subscribe virtools-user-group" to
> Majordomo@lists.theswapmeet.com
> > To post a message: send it to virtools-user-group@lists.theswapmeet.com
> > ...............................................................

...............................................................
Distributed via the virtools-user-group list: http://www.theswapmeet.com/numl.html
To reply to the list instead of its author, use "Reply to All"
To unsubscribe: send "unsubscribe virtools-user-group" to Majordomo@lists.theswapmeet.com
To subscribe: send "subscribe virtools-user-group" to Majordomo@lists.theswapmeet.com
To post a message: send it to virtools-user-group@lists.theswapmeet.com
...............................................................


Follow-Ups: