Maxon Developers Maxon Developers
    • Documentation
      • Cinema 4D Python API
      • Cinema 4D C++ API
      • Cineware API
      • ZBrush GoZ API
      • Code Examples on Github
    • Forum
    • Downloads
    • Support
      • Support Procedures
      • Registered Developer Program
      • Plugin IDs
      • Contact Us
    • Categories
      • Overview
      • News & Information
      • Cinema 4D SDK Support
      • Cineware SDK Support
      • ZBrush 4D SDK Support
      • Bugs
      • General Talk
    • Unread
    • Recent
    • Tags
    • Users
    • Login

    NetSendData() custom data/messages

    SDK Help
    0
    4
    358
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • H
      Helper
      last edited by

      On 10/11/2015 at 14:53, xxxxxxxx wrote:

      User Information:
      Cinema 4D Version:   16 
      Platform:   Windows  ;   
      Language(s) :     C++  ;

      ---------
      Is it possible to send custom messages with NetSendData()? It seems like when I pass my own plugin
      ID, I always get MESSAGERESULT_UNKNOWN error and the message is not sent to the TR server. Small
      example:

      struct NetRenderMsgVbGi
      {
        UInt size;
        Bool compute, wait;
      };
        
      NetRenderBuffer msg, result;
      msg.id = MSG_NETRENDER_VB_GI;
      msg.job = vps->net->_renderJob->GetUuid();
      msg.size = 0;  
      msg.data = nullptr;
        
      MESSAGERESULT res = NetSendData(
        vps->net->_service, vps->net->_renderJob->GetServerUuid(), &msg, &result, vps->thread);
      

      Thanks in advance,
      -Niklas

      1 Reply Last reply Reply Quote 0
      • H
        Helper
        last edited by

        On 11/11/2015 at 02:30, xxxxxxxx wrote:

        Hello,

        using R17 I have no problems using this code to send a message:

          
        Int32* payload = NewObjClear(Int32, 1);  
        *payload = 123;  
          
        // prepare message  
        NetRenderBuffer requestMessage;  
        requestMessage.id                        = MSG_CUSTOM;  
        requestMessage.job                    = data->_vps->net->_renderJob->GetUuid();  
        requestMessage.size                    = SIZEOF(Int32);  
        requestMessage.data                    = payload;  
          
        NetRenderBuffer requestResult;  
        requestResult.id                    = MSG_CUSTOM;  
        requestResult.job                    = data->_vps->net->_renderJob->GetUuid();  
        requestResult.size                = 0;  
        requestResult.data                = nullptr;  
          
        NetSendData(data->_vps->net->_service, data->_vps->net->_renderJob->GetServerUuid(), &requestMessage, &requestResult, data->_vps->thread);  
          
        if(requestResult.data)  
        {  
         Int32* res = (Int32* )requestResult.data;  
         GePrint("Got data from server: " + String::IntToString(*res));  
        }  
        

        best wishes,
        Sebastian

        1 Reply Last reply Reply Quote 0
        • H
          Helper
          last edited by

          On 11/11/2015 at 03:29, xxxxxxxx wrote:

          Hi Sebastian, thanks for the example. Seems like you really need a payload, it doesn't work without here
          in R16. Strangely, it works without payload for sending standard Net messages (eg. MSG_NETRENDER_BUCKET_INFO or ~_INDEX).

          One thing I'm still wondering about though is about byte order. Won't there be issues with
          machines that communicate with this interface and use a different byte order?

          Thanks,
          -Niklas

          1 Reply Last reply Reply Quote 0
          • H
            Helper
            last edited by

            On 13/11/2015 at 00:25, xxxxxxxx wrote:

            Hello,

            according to the developers, you are responsible for the endianess of the data chunk stored in NetRenderBuffer::data.

            Best wishes,
            Sebastian

            1 Reply Last reply Reply Quote 0
            • First post
              Last post