[Ace-users] [ace-users] [ACE svc_handler message queue] message not added tothe queue

Steve Huston shuston at riverace.com
Wed Mar 12 11:33:38 CDT 2008


Hi Mateusz,

In the future, please include the PROBLEM-REPORT-FORM.

Read your code carefully... You're not putting anything in the
header_block.

-Steve

--
Steve Huston, Riverace Corporation
Want to take ACE training on YOUR schedule?
See http://www.riverace.com/training.htm


> -----Original Message-----
> From: ace-users-bounces at cse.wustl.edu 
> [mailto:ace-users-bounces at cse.wustl.edu] On Behalf Of Mateusz 
> Berezecki
> Sent: Wednesday, March 12, 2008 7:04 AM
> To: ace-users at cse.wustl.edu
> Subject: [ace-users] [ACE svc_handler message queue] message 
> not added tothe queue
> 
> 
> Hello list readers,
> 
> I have a following problem with ACE 5.6.3
> 
> 		const size_t max_payload_size = 8192;
> 		ACE_OutputCDR payload(max_payload_size);
> 		
> 		/* message serialization
> 		 * note: this basically boils down to
> 		 * payload << msg; but we have to do it
> 		 * the 'right-way' via an interface */
> 		msg.serialize(payload);
> 				
> 		/* Creates message header containing byte order,
> 		 * payload length and message type */
> 		
> 		ACE_DEBUG((LM_DEBUG, ACE_TEXT("%IMessage length 
> is %d (%d)\n"),
> 				payload.total_length(),
msg.length()));
> 		
> 		ACE_CDR::ULong length = payload.total_length();
> 		ACE_OutputCDR header(ACE_CDR::MAX_ALIGNMENT + 
> MESSAGE_HEADER_SIZE);
> 		
> 		header << 
> ACE_OutputCDR::from_boolean(ACE_CDR_BYTE_ORDER);
> 		header << ACE_CDR::ULong(length);
> 		header << msg.type();
> 		header << msg.priority();
> 		
> 		ACE_Message_Block *header_block, *data_block;
> 		
> 		ACE_NEW_RETURN(header_block, 
> ACE_Message_Block(MESSAGE_HEADER_SIZE),  
> -1);
> 		ACE_NEW_RETURN(data_block, 
> ACE_Message_Block(length), -1);
> 		
> 		/* dump serialized data from header CDR structure
> 		 * to header_block which holds final binary data */
> 		ACE_DEBUG((LM_DEBUG, ACE_TEXT("Writing %d bytes 
> to the header  
> message block\n"), header.total_length()));
> 		
> 		if (!header.write_char_array(header_block->wr_ptr(),  
> MESSAGE_HEADER_SIZE))
> 		{
> 			ACE_DEBUG((LM_ERROR, ACE_TEXT("Can't 
> write header. Why?\n")));
> 		}
> 		ACE_DEBUG((LM_DEBUG, ACE_TEXT("Length of header 
> block after write is  
> %d bytes.\n"), header_block->length()));
> 		/* dump serialized data from data CDR structure
> 		 * to data_block which holds final binary data */
> 		ACE_DEBUG((LM_DEBUG, ACE_TEXT("Writing %d bytes 
> to the data message  
> block\n"), length));
> 		
> 		payload.write_char_array(data_block->wr_ptr(),
length);
> 		
> 		
> 		/* Chain header and data message blocks together */
> 		header_block->cont(data_block);
> 		
> 		/* queue the message for sending. */
> 		ACE_DEBUG((LM_DEBUG, ACE_TEXT("Queueing message 
> of length %d in the  
> send queue.\n"), header_block->total_length()));
> 		this->putq(header_block);
> 
> 
> the code above does not really copy the data into the message
blocks.
> I have no idea why but the output is pasted below:
> 
> $ ./services/transporttest
> (...)
> Message length is 8 (8)
> Writing 16 bytes to the header message block
> Length of header block after write is 0 bytes.
> Writing 8 bytes to the data message block
> Queueing message of length 0 in the send queue.
> (...)
> Message of length 0 fetched from the send queue.
> 0 bytes transferred.
> releasing message from the queue
> (...)
> $
> 
> 
> Does anybody have any suggestions?
> 
> best regards,
> Mateusz Berezecki
> 
> _______________________________________________
> ace-users mailing list
> ace-users at mail.cse.wustl.edu
> http://mail.cse.wustl.edu/mailman/listinfo/ace-users
> 




More information about the Ace-users mailing list