[vtkusers] vtkServerSocket

Utkarsh Ayachit utkarsh.ayachit at kitware.com
Tue Dec 9 16:41:23 EST 2008


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