Re: another sockets library



Hi Frank,

On May 13, 2:50 am, Frank Buss <f...@xxxxxxxxxxxxx> wrote:
I've created a small library for asynchronous sockets. They are used in
high performance web servers, like lighthttpd, because you need only one
thread for serving thousands of clients.

http://www.frank-buss.de/lisp/net-0.1.tgz

Currently it is C, only, but platform independant (works on Windows, Mac
OSX and Linux). There is a server and client example.

The goal of this library is to asynchronous server and client sockets for
TCP and UDP. Documentation is in net.h. For Windows I have already created
a Visual Studio .NET project, which creates a DLL and the sample programs.
For Linux and Mac there are shell scripts, which compiles the server and
client program.

The netWait function calls the onNetRead callbacks, if there are some data
for a socket available. With netRead the data will be read non-blocking. If
less data is read than in the OS buffer, the callback will be called again
(this is called level-triggered).

If you write data, it writes as much as possible without blocking. If less
bytes than requested are written, the onWrite callback is called again,
when it is possible to write more bytes without blocking. This is some kind
of edge-triggered, because it is only signalled once, after some data has
been written, and not all the time, when new data can be written. This
concept is used in Windows by default and simulated on the other platforms.

The implementation was a bit difficult, because there are different
underlying concepts on the 3 systems, because the (mostly) platform
independant "select" has a file limit of 64 on Windows and some Linux
systems.

I've seen this remark about Windows sockets and select() a few times
before. Being an author of a sockets library for Lisp myself (and
aiming for
maximum portability - without additional requirements!) I was
triggered by
it and went on a web-seach.

What you see is actually not true, as
http://www.sockets.com/winsock.htm#Deviation_MaxSockets points out:

"The maximum number of sockets which a Windows Sockets application
can make use of is determined at compile time by the manifest
constant
FD_SETSIZE. This value is used in constructing the fd_set structures
used in select(). The default value in winsock.h is 64. If an
application is
designed to be capable of working with more than 64 sockets, the
implementor should define the manifest FD_SETSIZE in every source
file
before including winsock.h. One way of doing this may be to include
the
definition within the compiler options in the makefile, for example
adding
-DFD_SETSIZE=128 as an option to the compiler command line for
Microsoft C. It must be emphasized that defining FD_SETSIZE as a
particular value has no effect on the actual number of sockets
provided by
a Windows Sockets implementation."

Anyway, I hope it helps you to simplify your code where possible. I
intend to
use it myself where I need to in order to make my library's behaviour
match
with most unices.

bye,


Erik.

.



Relevant Pages

  • RE: Printing from Win9x clients stops
    ... Open Server Management. ... then right-click the name of the computer running Windows Small Business ... >From the client computer: ... The Select Network Component Type ...
    (microsoft.public.windows.server.sbs)
  • RE: Printing from Win9x clients stops
    ... The printers with 9x drivers on the server appeared automatically in the ... > then right-click the name of the computer running Windows Small Business ... > From the client computer: ... The Select Network Component Type ...
    (microsoft.public.windows.server.sbs)
  • Re: after installing KB011829 OWA is not working anymore
    ... Based on my research, after you install hotfix KB911829, I suggest we ... Profile WMI Provider to each client computer that is running Windows Vista ... If you are running the Premium Edition of Windows Small Business Server ...
    (microsoft.public.exchange.connectivity)
  • Re: DHCP Issues. Very strange
    ... I understand the issue to be: some client computers ... can not obtain IP from SBS server. ... it is most possible a client side issue of Windows ... since you have join it to SBS domain and the Windows XP SP2 ...
    (microsoft.public.windows.server.sbs)
  • Re: Asynchronous socket programming vs. remoting
    ... You are the first person that said I should use sockets. ... them quicker than I can load them from my harddrive using the file system. ... It scales nice too - I tried throwing 400 requests at the server in a span ... > do not need the same assembly on the client and server. ...
    (microsoft.public.dotnet.languages.csharp)