IPC: Passing "big" buffer to server


#1

Hi,

My app has to send some data to the network. These data are collected from a component (A) and send to another (B) in order to be sent to the network.

The component in charge of the sending to the remote server provides following API:

FUNCTION int connect
(
	string url[32] IN,
	int port IN, 
	string deviceId[32] IN,
	string username[32] IN,
	string password[32] IN
);

FUNCTION int publish
(
	string payload[MAX_BUFFER_SIZE] IN,
	int payloadlength IN
);

I noticed that when the MAX_BUFFER_SIZE is set to a value > 1000 the value of payloadlength is not correct in my server.
For exemple if A called the publish service with a buffer size equals to 4900 bytes and as a consequence the payloadlength equals 4900 the payloadlength received into my component B is not equal to 4900 (As an example I just had 1853212).

[]Is this a legato limitation ?[/]
[]What can you advise me to send big buffer through an IPC ? should I use file to log my data and read them from the service function[/]

Note: I have to acquired about 500 bytes of data per seconds.

Thanks for your help !

David


#2

Hello David,

The current maximum message payload is in fact 1000 bytes as you have seen. Now that ifgen supports type definitions, this limitation should be addressed in a future release.

In the mean time, one option for handling this is to create a pipe and pass your data through it.

FUNCTION int connect
(
   string url[32] IN,
   int port IN,
   string deviceId[32] IN,
   string username[32] IN,
   string password[32] IN,
   file publishData IN
);

Then you can monitor that file descriptor using the event API.

http://www.legato.io/legato-docs/15_01/c_event_loop.html#c_event_files

-Kelly