delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1999/09/22/19:39:14

From: Richard Dawe <rich AT tudor21 DOT net>
Newsgroups: comp.os.msdos.djgpp
Subject: Re: libsocket
Date: Tue, 21 Sep 1999 22:53:44 +0100
Organization: Customer of Planet Online
Lines: 70
Message-ID: <37E7FE68.C457B1F@tudor21.net>
References: <3D9BEAC1CCA AT gyarab DOT cz>
NNTP-Posting-Host: modem-67.hytrin.dialup.pol.co.uk
Mime-Version: 1.0
X-Trace: news8.svr.pol.co.uk 938022965 1213 62.136.72.67 (22 Sep 1999 17:56:05 GMT)
NNTP-Posting-Date: 22 Sep 1999 17:56:05 GMT
X-Complaints-To: abuse AT theplanet DOT net
X-Mailer: Mozilla 4.51 [en] (X11; I; Linux 2.2.10 i586)
X-Accept-Language: de,fr
X-NNTP-Posting-Host: iolanthe.tudor21.net
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp
Reply-To: djgpp AT delorie DOT com

Hello.

Sanda AT 97 DOT gyarab DOT cz wrote:
> Recently i downloaded libsocket 0.7.4 beta 3 by R(?ichard
> )D(?avis)(forgor teh name:)).

I am the one you speak of - Richard Dawe ;)

> I discovered these bugs that are in linux manpages also.

The documentation isn't actually in synchronisation with the code, so that
wouldn't surprise me. Hopefully things will be better when the info docs
are finished.

> 1) DEMO program servern which should be in nonblocking mode
> has wrong option set in fcntl(socket,SET_FL(or
> wahtever),O_NONBLOCK(!!!)). That's it.

fcntl(sock, SET_FL, O_NONBLOCK);

That should set the socket into non-blocking mode. If you're worried about
all the other flags, then don't, because O_NONBLOCK is the only one that
works at the moment. All versions of libsocket previous to the current
development snapshot have a bug that stops you from doing this:

fcntl(sock, SET_FL, O_NONBLOCK | fcntl(sock, GET_FL));

Clearly doing an fcntl() without checking its return value is a bad idea.
You could always do this:

x = 1;
ioctl(sock, FIONBIO, &x);

if you don't like fcntl().

Have I missed the point? servern works fine in non-blocking mode for me...

> ANother thing is that setsockopt(socket,SOL_SOCK,RCWLOVAT);
> It should set minimum input buffer(the last define is prob. wrong)
> (i don't have man pages right here)).In libsocket it writes(errno)
> ENOPROTOSYS  - function not supported at this level.
> That's a good joke!

It's not a joke - it's deadly serious. Many setsockopt() options are not
supported by libsocket, because the low-level interfaces it uses don't
support the options. This is unlikely to change.

> Last thing that is even in linux man mage recv(2).
> It's stated there that i can use recv(socket, buf,
> sizeof(buf),MSG_WAITALL) to get the whole buffer filled(blocking or
> not..)). Alas there is no such constant as MSG_WAITALL defined in all
> the linux includes. Friend of mine found MSG_WAITALL define(0x44) in
> some WURG or so sources but not in his linux. I don't really think
> that all this is flaw of libsocket. It's more probably flaw in linux
> functions.

I may get round to implementing MSG_WAITALL sometime. It's something that
could be added. Whether it's worth it or needed is another question, i.e.
it's not a high priority.

If you're interested in what libsocket supports/doesn't support, I
recommend you join the libsocket mailing list or look at its archives:

http://www.phekda.freeserve.co.uk/richdawe/lsck/lsck_ml.htm

Bye, Rich =]

-- 
Richard Dawe
richdawe AT bigfoot DOT com ICQ 47595498 http://www.bigfoot.com/~richdawe/

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019