[sane-devel] [PATCH v2 10/14] net, implement O_NONBLOCK stuff for win32

2012-01-24 Thread Ruediger Meier
From: Ruediger Meier ruediger.me...@ga-group.nl

---
 backend/net.c |5 +
 1 files changed, 5 insertions(+), 0 deletions(-)

diff --git a/backend/net.c b/backend/net.c
index 5946a1b..03133d3 100644
--- a/backend/net.c
+++ b/backend/net.c
@@ -2363,7 +2363,12 @@ sane_set_io_mode (SANE_Handle handle, SANE_Bool 
non_blocking)
   return SANE_STATUS_INVAL;
 }
 
+#if ! defined _WIN32
   if (fcntl (s-data, F_SETFL, non_blocking ? O_NONBLOCK : 0)  0)
+#else
+  u_long iMode = non_blocking;
+  if (ioctlsocket(s-data, FIONBIO, iMode) != NO_ERROR)
+#endif
 {
   DBG (1, sane_set_io_mode: fcntl failed (%s)\n, strerror (errno));
   return SANE_STATUS_IO_ERROR;
-- 
1.7.6.1




[sane-devel] [PATCH v2 10/14] net, implement O_NONBLOCK stuff for win32

2012-01-24 Thread Chris Bagwell
On Mon, Jan 23, 2012 at 5:05 PM, Ruediger Meier sweet_f_a at gmx.de wrote:
 From: Ruediger Meier ruediger.meier at ga-group.nl

 ---
 ?backend/net.c | ? ?5 +
 ?1 files changed, 5 insertions(+), 0 deletions(-)

 diff --git a/backend/net.c b/backend/net.c
 index 5946a1b..03133d3 100644
 --- a/backend/net.c
 +++ b/backend/net.c
 @@ -2363,7 +2363,12 @@ sane_set_io_mode (SANE_Handle handle, SANE_Bool 
 non_blocking)
 ? ? ? return SANE_STATUS_INVAL;
 ? ? }

 +#if ! defined _WIN32
 ? if (fcntl (s-data, F_SETFL, non_blocking ? O_NONBLOCK : 0)  0)
 +#else
 + ?u_long iMode = non_blocking;
 + ?if (ioctlsocket(s-data, FIONBIO, iMode) != NO_ERROR)
 +#endif

Is this UDP or TCP?  If UDP, can you switch to
sanei_udp_set_nonblock() that I recently added for epson2 network
support?

If TCP, can you add mirror function to sanie_tcp or maybe create a
sanei_net.c for functions common to both UDP and TCP?

Chris

 ? ? {
 ? ? ? DBG (1, sane_set_io_mode: fcntl failed (%s)\n, strerror (errno));
 ? ? ? return SANE_STATUS_IO_ERROR;
 --
 1.7.6.1


 --
 sane-devel mailing list: sane-devel at lists.alioth.debian.org
 http://lists.alioth.debian.org/cgi-bin/mailman/listinfo/sane-devel
 Unsubscribe: Send mail with subject unsubscribe your_password
 ? ? ? ? ? ? to sane-devel-request at lists.alioth.debian.org