public inbox for cygwin@cygwin.com
 help / color / mirror / Atom feed
* DuplicateHandle() failing under MS Telnet Server
@ 2001-02-10 20:51 Dan Plimak
  2001-02-10 20:58 ` Christopher Faylor
  2001-02-12  4:44 ` Warren Young
  0 siblings, 2 replies; 5+ messages in thread
From: Dan Plimak @ 2001-02-10 20:51 UTC (permalink / raw)
  To: cygwin

Hi,

When trying to set up /bin/bash.exe as my default shell in MS Telnet Server
under Windows 2000, I'd encountered the following message: 

"... couldn't make stderr distinct from stdout"

Investigation revealed that you guys are bailing out on a DuplicateHandle()
failure when you notice that stdout is the same as stderr and attempt to
give stderr a different handle than stdout.

This patently won't work under MS Telnet server as from what I can tell (I
_may_ be wrong), they are using a kludge where they make a handle from a
socket fd, which is distinct from a regular Windows resource/file handle and
hence things that may be done with a handle fail.

I may be willing to look for a workaround for this problem--but first I need
to make sure that one does not already exist.

Again, I may be wrong (I had all of 5 minutes to think about this :-)), so
your response will give me a hint whether to proceed investigating this or
to drop it and get some more coffee.

  -- danp


--
Want to unsubscribe from this list?
Check out: http://cygwin.com/ml/#unsubscribe-simple

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: DuplicateHandle() failing under MS Telnet Server
  2001-02-10 20:51 DuplicateHandle() failing under MS Telnet Server Dan Plimak
@ 2001-02-10 20:58 ` Christopher Faylor
  2001-02-12  4:44 ` Warren Young
  1 sibling, 0 replies; 5+ messages in thread
From: Christopher Faylor @ 2001-02-10 20:58 UTC (permalink / raw)
  To: cygwin

On Mon, Feb 12, 2001 at 05:43:35PM +1300, Dan Plimak wrote:
>Hi,
>
>When trying to set up /bin/bash.exe as my default shell in MS Telnet Server
>under Windows 2000, I'd encountered the following message: 
>
>"... couldn't make stderr distinct from stdout"
>
>Investigation revealed that you guys are bailing out on a DuplicateHandle()
>failure when you notice that stdout is the same as stderr and attempt to
>give stderr a different handle than stdout.
>
>This patently won't work under MS Telnet server as from what I can tell (I
>_may_ be wrong), they are using a kludge where they make a handle from a
>socket fd, which is distinct from a regular Windows resource/file handle and
>hence things that may be done with a handle fail.
>
>I may be willing to look for a workaround for this problem--but first I need
>to make sure that one does not already exist.
>
>Again, I may be wrong (I had all of 5 minutes to think about this :-)), so
>your response will give me a hint whether to proceed investigating this or
>to drop it and get some more coffee.

Why not use the cygwin telnetd?  Then you won't have these problems.

cgf

--
Want to unsubscribe from this list?
Check out: http://cygwin.com/ml/#unsubscribe-simple

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: DuplicateHandle() failing under MS Telnet Server
  2001-02-10 20:51 DuplicateHandle() failing under MS Telnet Server Dan Plimak
  2001-02-10 20:58 ` Christopher Faylor
@ 2001-02-12  4:44 ` Warren Young
  2001-02-13  0:33   ` Dan Plimak
  1 sibling, 1 reply; 5+ messages in thread
From: Warren Young @ 2001-02-12  4:44 UTC (permalink / raw)
  To: Cygwin-L

Dan Plimak wrote:
> 
> This patently won't work under MS Telnet server as from what I can tell (I
> _may_ be wrong), they are using a kludge where they make a handle from a
> socket fd, which is distinct from a regular Windows resource/file handle and
> hence things that may be done with a handle fail.

This is a "feature" of Microsoft stacks.  You can use DuplicateHandle()
with Winsock 1.1 to do odd things that normally require the new
WSADuplicateSocket() and other new Winsock 2/Win32 functionality.  For a
fuller explanation, there's an article in my FAQ about this, called
"Passing Sockets Between Processes".

This feature could be used to implement dup() or maybe dup2() on Winsock
1.1 systems, but that's basically only Windows 95, so it's of fairly
little value these days.  (Win98+ and NT 4+ have Winsock 2 installed by
default.)
-- 
= Warren Young, maintainer of the Winsock Programmer's FAQ at:
=     http://www.cyberport.com/~tangent/programming/winsock/
= 
= ICBM Address: 36.8274040 N, 108.0204086 W, alt. 1714m

--
Want to unsubscribe from this list?
Check out: http://cygwin.com/ml/#unsubscribe-simple

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: DuplicateHandle() failing under MS Telnet Server
  2001-02-12  4:44 ` Warren Young
@ 2001-02-13  0:33   ` Dan Plimak
  0 siblings, 0 replies; 5+ messages in thread
From: Dan Plimak @ 2001-02-13  0:33 UTC (permalink / raw)
  To: Cygwin-L

On Mon, Feb 12, 2001 at 05:44:43AM -0700, Warren Young wrote:
> This is a "feature" of Microsoft stacks.  You can use DuplicateHandle()
> with Winsock 1.1 to do odd things that normally require the new
> WSADuplicateSocket() and other new Winsock 2/Win32 functionality.  For a
> fuller explanation, there's an article in my FAQ about this, called
> "Passing Sockets Between Processes".
> 
> This feature could be used to implement dup() or maybe dup2() on Winsock
> 1.1 systems, but that's basically only Windows 95, so it's of fairly
> little value these days.  (Win98+ and NT 4+ have Winsock 2 installed by
> default.)

Incidentally, it has always pained me to remember that a socket != HANDLE in
Winsock. This underscores the fact that MS's Berkeley sockets implementation
is only a half-assed emulation layer on top of Winsock's WSAxxx function
family, and convenient stuff people are used to doing under UNIX like doing
write()s and read()s on sockets don't work.

*sigh*

> = Warren Young, maintainer of the Winsock Programmer's FAQ at:

  -- danp


--
Want to unsubscribe from this list?
Check out: http://cygwin.com/ml/#unsubscribe-simple

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: DuplicateHandle() failing under MS Telnet Server
@ 2001-02-10 21:05 Dan Plimak
  0 siblings, 0 replies; 5+ messages in thread
From: Dan Plimak @ 2001-02-10 21:05 UTC (permalink / raw)
  To: cygwin

> Why not use the cygwin telnetd?  Then you won't have these
> problems.
>
> cgf

Er, yeah -- I have considered this.

I am still thinking, however, that MS Telnetd may be coerced into
cooperation. Or maybe I'm just delusional.

  -- danp





--
Want to unsubscribe from this list?
Check out: http://cygwin.com/ml/#unsubscribe-simple

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2001-02-13  0:33 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2001-02-10 20:51 DuplicateHandle() failing under MS Telnet Server Dan Plimak
2001-02-10 20:58 ` Christopher Faylor
2001-02-12  4:44 ` Warren Young
2001-02-13  0:33   ` Dan Plimak
2001-02-10 21:05 Dan Plimak

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).