[Paraview] Using MobileSocketPlugin to get metadata

Bueter, Travis J. (S&T-Student) tjbxv7 at mail.mst.edu
Fri Apr 19 16:23:11 EDT 2013


Hi,

I am trying to get the "metadata" from ParaView by connecting to the socket. I'm having an issue where I am correctly sending the command to send the data but I'm not receiving the length value or string correctly. Below is my method how I am currently trying to get the length value:

// In the main program //
                command = 2;
                if(-1 == send(socket, &command, sizeof(command), 0))
                                exit(1);

                int size;
                unsigned long long length;
                if((size = Receive(socket, &length, sizeof(unsigned long long)) <= 0)
                                exit(1);
                cout << size << endl;
                cout << length << endl;

// Receive function //
int Receive( cons int sk, void* data, int len)
{
                                char* buffer = reinterpret_cast<char*>(data);
                                int total = 0;
                                do
                                {
                                                int nRecvd = recv(socket, buffered+total, len-total, 0);
                                                if(nRecvd == 0)
                                                {
                                                                cout << "No Data Received" << endl;
                                                                exit(1);
                                                }
                                                if(nRecvd == -1)
                                                {
                                                                cout << "Error" << endl;
                                                                exit(1);
                                                }
                                                total += nRecvd;
                                }while(total < len);
                                return total;
                }

Now in the source code of the MobileSocketPlugin, I added a printf to show the value of "length" before it is sent over the socket.  When I run my code, it succeeds without an error but the value of my "length" is not equal.  For example, if I connect and run my code immediately after starting up ParaView, it always sends a value of "1733"  but I receive a value of "7443178323969" every time.  I'm really not sure what I need to change to get this correct.  If someone could point me in the right direction on what I need to be doing to receive the metadata through MobileSocketPlugin, I would greatly appreciate it!

Thanks,

Travis J. Bueter
----------------------------------------------------------------------
Missouri University of Science and Technology - Junior
B.S. Computer Engineering/Computer Science
tjbxv7 at mail.mst.edu<mailto:tjbxv7 at mail.mst.edu>
(573)-238-5843

IT RSS
Treasurer - MS&T Robotics Competition Team
----------------------------------------------------------------------

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.paraview.org/pipermail/paraview/attachments/20130419/0f607699/attachment.htm>


More information about the ParaView mailing list