Mail Archives: djgpp/1999/07/08/21:00:16
I've made an FSEXT'ension handler for network socket I/O.
Now I which to tie a socket to a 'FILE*' in order to use fgets(),
fprintf() etc. with the sockets. But looking at fdopen() or setmode(),
FSEXT'ension handlers aren't called. I would think that my handler
would get an '__FSEXT_open' command, but it never does. Is this
intentional or an oversight?
My code looks something like this:
s = socket (AF_INET, SOCK_DGRAM, 0)
in socket(): __FSEXT_set_function (s, _fsext_demux);
fil = fdopen (s,"r+");
bind(), connect() etc.
if (fprintf(fil, "HELO %s\r\n", _hostname) < 0)
{
perror ("fprintf");
exit (-1);
}
The program always gives me fil=NULL and errno=EBADF.
What special tricks do I need to use a socket with stream functions?
Gisle V.
- Raw text -