Erlang/OTP Forums

Author Message

<  Advanced Erlang/OTP  ~  large term not read in port program

bikram.chatterjee
Posted: Tue Jun 21, 2011 6:32 pm Reply with quote
Joined: 21 Jun 2011 Posts: 2 Location: Switzerland
Hi all,

I am posting to this forum for the first time so please help in correcting any posting protocol errors.

I am stuck with a peculiar problem. I want to send a big term from a C process loaded as port program by a gen_server. I am receiving them in a gen_server using
Code:
handle_info({Post, {data, Data}})

The port is opened as
Code:
open_port({spawn, Executable}, [{packet, 4}, binary, exit_status, use_stdio]))

In the C process I am using
Code:
erl_format("{~w}",...) // and other variations
to encode my data. Everything seems to work fine with smaller terms but it seems that if the term being sent is > ~200 bytes (after encoding) the data is not being picked up by the port at all (at least
Code:
port_info(Port, input)
doesn't change).

What might I be doing wrong? Any direction/help/suggestions will be highly appreciated.

BR/Bikram

NB: I tried to search the forum and did not find any. Please point me to original one is this is a duplicate post.
View user's profile Send private message Send e-mail
bikram.chatterjee
Posted: Wed Jun 22, 2011 12:49 pm Reply with quote
Joined: 21 Jun 2011 Posts: 2 Location: Switzerland
Hi all,

Solved it finally.

It seems that C encoding code that was computing the length of binary encoded erlang term as 32 bit integer in network byte order was returning 0 bytes for any binary payload of greater than 0xFF. How silly!

Anyway, until next time then.

Thanks/Bikram
View user's profile Send private message Send e-mail

Display posts from previous:  

All times are GMT
Page 1 of 1
This forum is locked: you cannot post, reply to, or edit topics.

Jump to:  

You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You cannot download files in this forum