[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
RE : [lwip-users] LWIP_COMPAT_SOCKETS in sockets.h
From: |
Goldschmidt Simon |
Subject: |
RE : [lwip-users] LWIP_COMPAT_SOCKETS in sockets.h |
Date: |
Thu, 7 Sep 2006 09:19:02 +0200 |
Hi Frédéric,
>
> In my application, I have comment these three "define",
> because I got an OS which already implements these calls. But
> I can use "recv", "send" and "closesocket". I have defined
> LWIP_COMPAT_SOCKETS because I port my application on several
> embedded target (and all implement BSD-like sockets
> interface). Using LWIP_IO_SOCKETS would be a way for users to
> tell if their OS already implement or nor these calls. If OS
> doesn't define these functions, we can define
> LWIP_IO_SOCKETS. It have to be undefined is OS implements them.
>
> In my target, If I wanted to write a pseudo code like yours,
> I could undefined LWIP_IO_SOCKETS (to avoid the compilation
> error), and I could write a "IO Driver" for my OS to
> implement call redirections for read, write and close (this
> is a possibility in my OS to extend the IO System) to avoid
> the runtime error.
>
> Perhaps LWIP_IO_SOCKETS is not the good name, and something
> like LWIP_POSIX_IO_SOCKETS will be better, or
> LWIP_OS_UNIMPLEMENTED_POSIX_CALLS...
>
This is indeed a problem. Altera, for example has solved it by writing wrapper
functions which look at the value of the socket descriptor (int). However, for
this to work, you must define a range for sockets and a range for the rest,
which is not really a great thing.
I think that either a good wrapper should be implemented with lwIP (which could
be difficult) or (better) you could simply write this wrapper and include it in
the port for your OS (which you have to create anyway...).
Simon