Hello Michael,

On 29. Sep 2011, at 21:41, Michael Pope [via Software] wrote:

> I have subclassed eq::Config and eq::Node. Call these classes EQConfig and 
> EQNode respectively. 
> 
> I registerCommand in eq::server::Config with a command of 
> eq::fabric::CMD_CONFIG_CUSTOM+1 on the mainQ (not really sure if that's the 
> right queue - there's also a cmdQ) 

They 'terminate' in the main thread and command thread, respectively.

> then in EQNode I registerCommand with a command of 
> eq::fabric::CMD_NODE_CUSTOM+1. 
> 
> Then I define a packet with a std::wstring member variable 'commandString'. 
> this packet has a function SetCommandString(const std::wstring& command) 
> which sets the member variable as well as adjusting the size of the packet to 
> include the string data.

Packets can only be PODs, since they are copied verbatim to the wire. To send 
variable-length data, the connection has some methods to do so. The basic idea 
is:

- The packet has an 8-byte stub of the array to send
- The sender passes the packet and array (string) to Connection::send
- The send call either copies the array into the stub or sends the Packet-8 
bytes (aka header) and then the array, updating the size field accordingly
- The receiver receives the packet in one go and reads the data from the stub 
position

Since these are really nitty-gritty details of Collage, I'm wondering if there 
is not a more elegant way, e.g., serializing the string as part of an object, 
to solve your problem. Even internally we're using this mechanism less and less 
and rather use co::Objects. Have a look at eqPly::FrameData::setMessage. Maybe 
you can describe why you're trying to send a string.

> Now, my problems start happening when I attempt to send the packet. 

You are sending a C++ object with a pointer (the std::wstring), this can't work.


HTH,

Stefan.



--
View this message in context: 
http://software.1713.n2.nabble.com/Sending-packets-containing-std-wstring-tp6845178p6846794.html
Sent from the Equalizer - Parallel Rendering mailing list archive at Nabble.com.
_______________________________________________
eq-dev mailing list
[email protected]
http://www.equalizergraphics.com/cgi-bin/mailman/listinfo/eq-dev
http://www.equalizergraphics.com

Reply via email to