Re: g_io_channel_read_to_end read just 998 chars, not more



I resolved part of the problem. The encoding problem was resolved with
base64 encoding between PHP and C. Now the problem is the same of the
first mail, the received string just have 998 characters. The
g_io_channel_read_to_end( channel, &string, &size, &erro ); don't show
any errors.  I also have tried the g_io_channel_read_line but the
limit of 998 characters happen again.

So, why I have this limit?

Here is a log of the received contend:

 received in base64:
bG9naW4gVFJVRXw=Mjc=fDM3MzY=fFRyZWluYW1lbnRvL1F1YWxpZmljYcOnw6NvIE1pb2xvfERpdmVyc29zIC0gRGV2ZWw=fEJhbmNvfDEwMDY=fDc0NjowNzowMA==fDExNzE=fDQxMTU=fFRyYWJhbGhhciBTb2xpcyAtIEFwcmVuZGl6YWdlbQ==fERpdmVyc29zIC0gRGV2ZWw=fDE1MDA6MDA6MDA=fDEwMDY=fDEwMDc6NTE6MDA=fDExNzE=fDM4NDQ=fEVzdHVkbyBGZXJyYW1lbnRhcyBNaW9sbw==fERpdmVyc29zIC0gRGV2ZWw=fEJhbmNvfDEwMDY=fDEzOTY6NDY6MDA=fDExNzE=fDM3MzE=fFRyYWJhbGhhciBuYSBTb2xpcyAtIERldmVsfERpdmVyc29zIC0gRGV2ZWw=fDEwMDA6MDA6MDAuMDAwMDAyfDEwMDY=fDMyMDo1NzowMA==fDExNzE=fDM1OTQ=fE1hbnV0ZW7Dp8OjbyBTaXN0ZW1hcyBJbnRlcm5vcw==fERpdmVyc29zIC0gU09MSVM=fEJhbmNvfDEwMDY=fDE4NTU6NTk6MDA=fDkyNg==fDQxNzI=fFRlc3Rlcw==fE1hcmF0b25hIDIwMDk=fDQwOjAwOjAwfDEwNDU=fDE1OjMwOjAwfDEyNDk=fDQxNzQ=fERpc3BvbmliaWxpemHDp8OjbyBkb3MgRm9ybXVsw6FyaW9zfEF2YWxpYcOnw6NvIEluc3RpdHVjaW9uYWwgMjAwOUE=fDUwOjAwOjAwfDEwNDU=fDMyOjA1OjAwfDEyNDg=fDQxNzY=fERlc2Vudm9sdmltZW50byBlIFJlZXN0cnV0dXJhw6fDo28gZG9zIEZvcm11bMOhcmlvcw==fEF2YWxpYcOnw6NvIEluc3RpdHVjaW9uYWwgMjAwOUE=fDEwMDowMDowMA==fDEwNDU=fDkyOjQwOjAwfDEyNDg=fD
size: 998


translated to utf8: login TRUE|27|3736|Treinamento/Qualificação
Miolo|Diversos - Devel|Banco|1006|746:07:00|1171|4115|Trabalhar Solis
- Aprendizagem|Diversos -
Devel|1500:00:00|1006|1007:51:00|1171|3844|Estudo Ferramentas
Miolo|Diversos - Devel|Banco|1006|1396:46:00|1171|3731|Trabalhar na
Solis - Devel|Diversos -
Devel|1000:00:00.000002|1006|320:57:00|1171|3594|Manutenção Sistemas
Internos|Diversos -
SOLIS|Banco|1006|1855:59:00|926|4172|Testes|Maratona
2009|40:00:00|1045|15:30:00|1249|4174|Disponibilização dos
Formulários|Avaliação Institucional
2009A|50:00:00|1045|32:05:00|1248|4176|Desenvolvimento e
Reestruturação dos Formulários|Avaliação Institucional
2009A|100:00:00|1045|92:40:00|1248
size: 692

2010/5/28 frederico schardong <frede sch gmail com>:
> As I talked later, my channel receives the output of a php script, in
> those script I have:
>
> echo "|" . utf8_encode($r) . "";
>
> I have changed the utf8_encode to base64_encode and my channel don't
> crash. What's the matter with utf8?
>
> 2010/5/28 frederico schardong <frede sch gmail com>:
>> This is very strange. Yesterday I have got 998 characters from the
>> g_io_channel_read_to_end, but today I have compiled with and without
>> the if to show the error, but every time I'm getting 0 characters from
>> the channel! I don't know what can cause it, because nothing has been
>> changed unless the if.
>>
>> 2010/5/28 frederico schardong <frede sch gmail com>:
>>> The error is:
>>>
>>> error: Canal termina num caractere parcial
>>>
>>> This means "Channel ending in a partial character".
>>>
>>> 2010/5/27 Robert Pearce <rob bdt-home demon co uk>:
>>>> Hi frederico,
>>>>
>>>> On Thu, 27 May 2010 11:02:47 -0300 you wrote:
>>>>> > Why don't you test the error returns?
>>>>> GError *b = NULL;
>>>>>
>>>>> g_io_channel_read_to_end( channel, &string, &size, &b);
>>>>>
>>>>> g_print("returned: %s\nsize: %d\nerror: %s", string, size, b->message);
>>>>>
>>>>> It causes segmentation fault. What I'm doing wrong here?
>>>>
>>>> You're not testing the error return. If the g_io_channel_read_to_end completes without error, then it doesn't change 'b', so the printf is doing a de-reference of a NULL pointer. You should change it to :
>>>>
>>>> GError *b = NULL;
>>>>
>>>> g_io_channel_read_to_end( channel, &string, &size, &b);
>>>>
>>>> g_print("returned: %s\nsize: %d\n", string, size );
>>>> if ( b )
>>>>    g_print("error: %s\n", b->message);
>>>> _______________________________________________
>>>> gtk-list mailing list
>>>> gtk-list gnome org
>>>> http://mail.gnome.org/mailman/listinfo/gtk-list
>>>>
>>>
>>>
>>>
>>> --
>>> Thanks,
>>> Frederico Schardong,
>>> SOLIS - Open source solutions
>>> www.solis.coop.br
>>> Linux registered user #500582
>>>
>>
>>
>>
>> --
>> Thanks,
>> Frederico Schardong,
>> SOLIS - Open source solutions
>> www.solis.coop.br
>> Linux registered user #500582
>>
>
>
>
> --
> Thanks,
> Frederico Schardong,
> SOLIS - Open source solutions
> www.solis.coop.br
> Linux registered user #500582
>



-- 
Thanks,
Frederico Schardong,
SOLIS - Open source solutions
www.solis.coop.br
Linux registered user #500582


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]