[vtkusers] vtkServerSocket

Utkarsh Ayachit utkarsh.ayachit at kitware.com
Tue Dec 9 10:04:42 EST 2008


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