I wrote this wrapper awhile ago around the c++ client, this was before the 
c_glib client was fully available. Should be easy enough to add into your 
project if you need it right away. 

https://github.com/bterm/sandbox/tree/master/c/scribe_client



On Aug 24, 2011, at 8:30 AM, Michał Ziemba wrote:

> Hello,
> 
> I would like to use thrift's c_glib library to generate code that allows 
> me to send log messages from C programs to Facebook's scribe. I managed 
> to generate some code with scribe.thrift specification, and have written 
> a client code that should send a message to a local scribe instance.
> 
> I am using TBinaryProtocol and TFramedTransport (as needed by scribe), 
> and as a result the message is sent but scribe produces an error:
> 
> Thrift: Wed Aug 24 13:57:38 2011 TConnection:workSocket() Negative frame 
> size -2147418111, remote side not using TFramedTransport?
> 
> As you can see in the client code below, I am actually using 
> TFramedTransport, am I?
> What can be the problem?
> I am using thrift 0.6.1 and scribe 2.2 on a debian squeeze machine.
> 
> 
>     /* create a ThriftSocket */
>     tsocket = g_object_new(THRIFT_TYPE_SOCKET, "hostname", "localhost",
>                            "port", 1464, NULL);
> 
>     /* create ThriftFramedTransport */
>     transport = g_object_new(THRIFT_TYPE_FRAMED_TRANSPORT, "transport",
>                              THRIFT_TRANSPORT(tsocket), NULL);
> 
>     thrift_framed_transport_open(transport, NULL);
>     assert(thrift_framed_transport_is_open(transport));
> 
>     /* create a ThriftBinaryProtocol */
>     tb = g_object_new(THRIFT_TYPE_BINARY_PROTOCOL, "transport",
>                       tsocket, NULL);
>     protocol = THRIFT_PROTOCOL(tb);
>     assert(protocol != NULL);
> 
>     /* create a Scribe message */
>     message = g_object_new(TYPE_LOG_ENTRY, "category", "test_category",
>                            "message", "test message from C", NULL);
> 
>     messages = g_ptr_array_new();
>     g_ptr_array_add(messages, &message);
> 
>     /* create a Scribe Client */
>     client = g_object_new(TYPE_SCRIBE_CLIENT, "input_protocol",
>                           protocol, "output_protocol", protocol, NULL);
> 
>     iface = SCRIBE_IF(client);
>     assert(thrift_framed_transport_is_open(transport));
> 
>     scribe_client_log(iface, result, messages, &err);
> 
> 
> Thanks for any help,
> 
> Michał Ziemba

Reply via email to