Re: FILE* behaviour over BSD sockets - how?
From: Jem Berkes (jb_at_users.pc9.org)
Date: 05/13/04
- Next message: joe_at_invalid.address: "Re: FILE* behaviour over BSD sockets - how?"
- Previous message: Darko M.: "Re: FILE* behaviour over BSD sockets - how?"
- In reply to: Søren Hansen: "Re: FILE* behaviour over BSD sockets - how?"
- Next in thread: Barry Margolin: "Re: FILE* behaviour over BSD sockets - how?"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Date: 13 May 2004 15:37:27 GMT
>> The problem: I have to use a library (which I cannot modify) with an
>> API reading/writing records to FILE*. The data I have to read comes
>> through a socket. The socket has been set to blocking and I
>> successfully fdopen(socket). However, the API reads once in a while
>> incomplete records because the underlying socket calls seem to return
>> as soon as there is a packet to read but not when the whole requested
>> number of bytes has been read.
>
> I've never tried using it on sockets, but perhaps fdopen() will do the
> trick?
I had meant to try this myself on an earlier project. I just tried it now
under FreeBSD and it worked... fdopen on the socket with "r+" followed by
fgets and fprintf all worked as intended.
-- Jem Berkes http://www.sysdesign.ca/
- Next message: joe_at_invalid.address: "Re: FILE* behaviour over BSD sockets - how?"
- Previous message: Darko M.: "Re: FILE* behaviour over BSD sockets - how?"
- In reply to: Søren Hansen: "Re: FILE* behaviour over BSD sockets - how?"
- Next in thread: Barry Margolin: "Re: FILE* behaviour over BSD sockets - how?"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Relevant Pages
|