[vtkusers] vtkServerSocket, rendering and multithread

uzay emir uzayem at yahoo.com
Thu Dec 11 09:53:00 EST 2008


Hi All,



I want to receive data in one thread and render it in another, but
I have to make sure that the rendering thread starts rendering
only after the data has been received. I would like ask if Someone else tried these kind of things before?.


Any help would be appreciate

Uzay


--- On Thu, 12/11/08, Utkarsh Ayachit <utkarsh.ayachit at kitware.com> wrote:

> From: Utkarsh Ayachit <utkarsh.ayachit at kitware.com>
> Subject: Re: [vtkusers] vtkServerSocket
> To: uzayem at yahoo.com
> Cc: vtkusers at vtk.org
> Date: Thursday, December 11, 2008, 4:20 PM
> Uzay,
> 
> There should be examples/tests in VTK repository showing
> how to use
> the XYPlotActor so I am guessing that's not what you
> are asking. You
> can certainly receive data in one thread and render it in
> another, but
> you'll have to make sure that the rendering thread
> starts rendering
> only after the data has been received. Someone else who has
> tried such
> things may be able to shed more light on it.
> 
> Utkarsh
> 
> On Tue, Dec 9, 2008 at 5:16 PM, uzay emir
> <uzayem at yahoo.com> wrote:
> >
> >
> > Thank you again for your reply. sorry I think i did
> not understand. But my server client is working properly(in
> a thread). However, I have to plot the received data at the
> same time when the server or client received the data . My
> question is
> >
> > whether you are client or server, when you received
> the data, how can i plot the this data during and without
> crushing the client-server application. Or how can i extract
> the received data from the server or client thread  and
> transfer it to XYplotactor.
> >
> > Uzay
> >
> >
> >
> >
> >
> >
> > --- On Tue, 12/9/08, Utkarsh Ayachit
> <utkarsh.ayachit at kitware.com> wrote:
> >
> >> From: Utkarsh Ayachit
> <utkarsh.ayachit at kitware.com>
> >> Subject: Re: [vtkusers] vtkServerSocket
> >> To: uzayem at yahoo.com
> >> Cc: vtkusers at vtk.org
> >> Date: Tuesday, December 9, 2008, 11:41 PM
> >> Take a look at
> >> * VTK/Parallel/Testing/Cxx/SocketServer.cxx
> >> * VTK/Parallel/Testing/Cxx/SocketClient.cxx
> >>
> >> They illustrate how to send/receive data.
> >>
> >> Utkarsh
> >>
> >> On Tue, Dec 9, 2008 at 4:28 PM, uzay emir
> >> <uzayem at yahoo.com> wrote:
> >> > Thank you for your reply. I have solved my
> problem. It
> >> was my fault. However, I have another issue, i
> need your
> >> advice. My client-server application is going to
> send that
> >> data to vtkXYPlotActor. when it receives the data,
> it is
> >> going to refresh or add the data at the end of the
> >> vtkXYPlotActor. I do not howto where to start
> this, is there
> >> any example  or test file this kind of
> application.
> >> >
> >> > By the way, Right now my client-server is
> working in a
> >> vtkMultiThreader object. It seems that i need
> generate
> >> another thread but i do not know howto get the
> received data
> >> from client-server.
> >> >
> >> > Any help would be appreciate
> >> >
> >> >  Uzay
> >> >
> >> >
> >> >
> >> >
> >> >
> >> > --- On Tue, 12/9/08, Utkarsh Ayachit
> >> <utkarsh.ayachit at kitware.com> wrote:
> >> >
> >> >> From: Utkarsh Ayachit
> >> <utkarsh.ayachit at kitware.com>
> >> >> Subject: Re: [vtkusers] vtkServerSocket
> >> >> To: "uzay emir"
> <uzayem at yahoo.com>
> >> >> Cc: vtkusers at vtk.org
> >> >> Date: Tuesday, December 9, 2008, 5:04 PM
> >> >> You are correct, before starting to use
> sockets
> >> you need to
> >> >> create a
> >> >> dummy instance of vtkSocketController and
> call
> >> Initialize()
> >> >> on it
> >> >> which does some socket intialization (for
> >> Windows).
> >> >> Your code seems fine to me. What is the
> error
> >> message you
> >> >> are getting?
> >> >> So you are able to receive one message,
> but it
> >> fails on
> >> >> trying to
> >> >> receive the second message?
> >> >>
> >> >> Utkarsh
> >> >>
> >> >>
> >> >> On Mon, Dec 8, 2008 at 5:26 PM, uzay emir
> >> >> <uzayem at yahoo.com> wrote:
> >> >> >
> >> >> >
> >> >> > Hello all,
> >> >> >
> >> >> > I'm working on a client-server
> >> application. Server
> >> >> tries to receive the data from client.I
> wrote the
> >> following
> >> >> script in order to test but it does not
> work
> >> properly.
> >> >> > Connection is established. However
> when i try
> >> to
> >> >> receive data, after the receiving the
> first buffer
> >> I get an
> >> >> error message.
> >> >> >
> >> >> >
> >> >> > I could not finid an example related
> to
> >> >> vtkServerSocket.h. The files that i found
> are anot
> >> utilizing
> >> >> vtkSocketController.h.
> >> >> > And I could not succed tto run
> >> vtkServerSocket without
> >> >> initializing the vtkSocketController.
> >> >> >
> >> >> >
> >> >> >
> >> >> > VTK_CREATE(vtkSocketController,
> contr);
> >> >> > contr->Initialize();
> >> >> > vtkServerSocket
> >> *ServerSocket=vtkServerSocket::New();
> >> >> > vtkClientSocket
> *cs=vtkClientSocket::New();
> >> >> >
> ServerSocket->CreateServer(11111);
> >> >> >
> >> >>
> >>
> printf("%d",ServerSocket->GetServerPort());
> >> >> >
> >> cs=ServerSocket->WaitForConnection(100000);
> >> >> > char datac[scMsgLength];
> >> >> > while (!this->ServerStopFlag){
> >> >> >                 int r =
> >> cs->Receive(&datac,
> >> >> scMsgLength);
> >> >> >
> >> >> >
> >> >> >
> >> >> >        }
> >> >> >
> >> >> >
> >> >> > Any help would be appreciate
> >> >> >
> >> >> > Uzay
> >> >> >
> >> >> >
> >> >> >
> >> >> >
> >> _______________________________________________
> >> >> > This is the private VTK discussion
> list.
> >> >> > Please keep messages on-topic. Check
> the FAQ
> >> at:
> >> >> http://www.vtk.org/Wiki/VTK_FAQ
> >> >> > Follow this link to
> subscribe/unsubscribe:
> >> >> >
> http://www.vtk.org/mailman/listinfo/vtkusers
> >> >> >
> >> >
> >> >
> >> >
> >> >
> >
> >
> >
> >


      



More information about the vtkusers mailing list