[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
[Monthly Archives]
[List Home]
Re: [Virtools] Implementation of a Client/Server building block
- Subject: Re: [Virtools] Implementation of a Client/Server building block
- From: rob_p@igss.net
- Date: Thu, 21 Jun 2001 10:36:00 -0400
I would create an instance of a manager that is responsible for
starting/stopping the threads, accepting connections, etc. Then write
building blocks which interact with the manager. I think this is the
cleanest and safest way to go. The manager simply receives incoming data =
and
stores it away in an internal data structure. The building blocks would t=
hen
query the manager for the any available messages (or whether there's
actually a connection established).
If you need more information, I'd be happy to elaborate.
----- Original Message -----
From: "Robert Praxmarer" <cubic@fl.aec.at>
To: "Rob Pringle" <robert.pringle@sympatico.ca>
Cc: <virtools-user-group@lists.theswapmeet.com>
Sent: Friday, February 23, 2001 6:55 AM
Subject: AW: [Virtools] Implementation of a Client/Server building block
> 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 outp=
ut
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=3Dfalse;
>
> // Start TCP/IP server thtread
>
> if(serverInit=3D=3Dfalse)
> {
> serverInit=3Dtrue;
> AfxBeginThread(TCPServer, beh, THREAD_PRIORITY_NORMAL);
> }
>
> beh->ActivateInput(0,FALSE);
> beh->ActivateOutput(0,TRUE);
> return CKBR_OK;
> }
>
> UINT TCPServer(LPVOID pParam)
> {
> int val=3D0;
> while(1)
> {
> val=3D!val;
> ((CKBehavior *)(pParam))->SetOutputParameterValue(1,&val);
> }
> return 0;
> }
>
> -----Urspr=FCngliche 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 bloc=
k
>
>
> What you're proposing certainly can be done. I've implemented something
> tihis
> already (client/server threadbased UDP/TCP building blocks) and it work=
s
> 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 necessa=
ry
> 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 threa=
d,
> 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.c=
om
> > ...............................................................
>
> ...............................................................
> 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
...............................................................
References: