<html xmlns:v="urn:schemas-microsoft-com:vml" xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:w="urn:schemas-microsoft-com:office:word" xmlns:m="http://schemas.microsoft.com/office/2004/12/omml" xmlns="http://www.w3.org/TR/REC-html40">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=us-ascii">
<meta name="Generator" content="Microsoft Word 14 (filtered medium)">
<style><!--
/* Font Definitions */
@font-face
        {font-family:Calibri;
        panose-1:2 15 5 2 2 2 4 3 2 4;}
/* Style Definitions */
p.MsoNormal, li.MsoNormal, div.MsoNormal
        {margin:0in;
        margin-bottom:.0001pt;
        font-size:11.0pt;
        font-family:"Calibri","sans-serif";}
a:link, span.MsoHyperlink
        {mso-style-priority:99;
        color:blue;
        text-decoration:underline;}
a:visited, span.MsoHyperlinkFollowed
        {mso-style-priority:99;
        color:purple;
        text-decoration:underline;}
span.EmailStyle17
        {mso-style-type:personal-compose;
        font-family:"Calibri","sans-serif";
        color:windowtext;}
.MsoChpDefault
        {mso-style-type:export-only;
        font-family:"Calibri","sans-serif";}
@page WordSection1
        {size:8.5in 11.0in;
        margin:1.0in 1.0in 1.0in 1.0in;}
div.WordSection1
        {page:WordSection1;}
--></style><!--[if gte mso 9]><xml>
<o:shapedefaults v:ext="edit" spidmax="1026" />
</xml><![endif]--><!--[if gte mso 9]><xml>
<o:shapelayout v:ext="edit">
<o:idmap v:ext="edit" data="1" />
</o:shapelayout></xml><![endif]-->
</head>
<body lang="EN-US" link="blue" vlink="purple">
<div class="WordSection1">
<p class="MsoNormal">Hi,<o:p></o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal">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:<o:p></o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal">// In the main program //<o:p></o:p></p>
<p class="MsoNormal"> command = 2;<o:p></o:p></p>
<p class="MsoNormal"> if(-1 == send(socket, &command, sizeof(command), 0))<o:p></o:p></p>
<p class="MsoNormal"> exit(1);<o:p></o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal"> int size;<o:p></o:p></p>
<p class="MsoNormal"> unsigned long long length;<o:p></o:p></p>
<p class="MsoNormal"> if((size = Receive(socket, &length, sizeof(unsigned long long)) <= 0)<o:p></o:p></p>
<p class="MsoNormal"> exit(1);<o:p></o:p></p>
<p class="MsoNormal"> cout << size << endl;<o:p></o:p></p>
<p class="MsoNormal"> cout << length << endl;<o:p></o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal">// Receive function //<o:p></o:p></p>
<p class="MsoNormal" style="text-indent:.5in">int Receive( cons int sk, void* data, int len)<o:p></o:p></p>
<p class="MsoNormal" style="text-indent:.5in">{<o:p></o:p></p>
<p class="MsoNormal"> char* buffer = reinterpret_cast<char*>(data);<o:p></o:p></p>
<p class="MsoNormal"> int total = 0;<o:p></o:p></p>
<p class="MsoNormal"> do<o:p></o:p></p>
<p class="MsoNormal"> {<o:p></o:p></p>
<p class="MsoNormal"> int nRecvd = recv(socket, buffered+total, len-total, 0);<o:p></o:p></p>
<p class="MsoNormal"> if(nRecvd == 0)<o:p></o:p></p>
<p class="MsoNormal"> {<o:p></o:p></p>
<p class="MsoNormal"> cout << “No Data Received” << endl;<o:p></o:p></p>
<p class="MsoNormal"> exit(1);<o:p></o:p></p>
<p class="MsoNormal"> }<o:p></o:p></p>
<p class="MsoNormal"> if(nRecvd == -1)<o:p></o:p></p>
<p class="MsoNormal"> {<o:p></o:p></p>
<p class="MsoNormal"> cout << “Error” << endl;<o:p></o:p></p>
<p class="MsoNormal"> exit(1);<o:p></o:p></p>
<p class="MsoNormal"> }<o:p></o:p></p>
<p class="MsoNormal"> total += nRecvd;<o:p></o:p></p>
<p class="MsoNormal"> }while(total < len);<o:p></o:p></p>
<p class="MsoNormal"> return total;<o:p></o:p></p>
<p class="MsoNormal"> }<o:p></o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal">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!
<o:p></o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal">Thanks,<o:p></o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal"><b><span style="font-family:"Times New Roman","serif"">Travis J. Bueter<o:p></o:p></span></b></p>
<p class="MsoNormal"><span style="font-family:"Times New Roman","serif"">----------------------------------------------------------------------<o:p></o:p></span></p>
<p class="MsoNormal"><i><span style="font-family:"Times New Roman","serif"">Missouri University of Science and Technology - Junior<b><o:p></o:p></b></span></i></p>
<p class="MsoNormal"><span style="font-family:"Times New Roman","serif"">B.S. Computer Engineering/Computer Science<o:p></o:p></span></p>
<p class="MsoNormal"><a href="mailto:tjbxv7@mail.mst.edu"><span style="font-family:"Times New Roman","serif";color:blue">tjbxv7@mail.mst.edu</span></a><span style="font-family:"Times New Roman","serif""><o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-family:"Times New Roman","serif"">(573)-238-5843<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-family:"Times New Roman","serif""><o:p> </o:p></span></p>
<p class="MsoNormal"><span style="font-family:"Times New Roman","serif"">IT RSS<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-family:"Times New Roman","serif"">Treasurer – MS&T Robotics Competition Team<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-family:"Times New Roman","serif"">----------------------------------------------------------------------<o:p></o:p></span></p>
<p class="MsoNormal"><o:p> </o:p></p>
</div>
</body>
</html>