www.delorie.com/archives/browse.cgi | search |
X-Recipient: | archive-cygwin AT delorie DOT com |
X-SWARE-Spam-Status: | No, hits=2.9 required=5.0 tests=AWL,BAYES_50,TW_CV,TW_SF,T_RP_MATCHES_RCVD |
X-Spam-Check-By: | sourceware.org |
Date: | Tue, 1 Jun 2010 20:06:08 +0100 |
From: | Bruce Cran <bruce AT cran DOT org DOT uk> |
To: | cygwin AT cygwin DOT com |
Subject: | Using custom Winsock socket functions with Cygwin |
Message-ID: | <20100601200608.00006958@unknown> |
Mime-Version: | 1.0 |
X-IsSubscribed: | yes |
Mailing-List: | contact cygwin-help AT cygwin DOT com; run by ezmlm |
List-Id: | <cygwin.cygwin.com> |
List-Subscribe: | <mailto:cygwin-subscribe AT cygwin DOT com> |
List-Archive: | <http://sourceware.org/ml/cygwin/> |
List-Post: | <mailto:cygwin AT cygwin DOT com> |
List-Help: | <mailto:cygwin-help AT cygwin DOT com>, <http://sourceware.org/ml/#faqs> |
Sender: | cygwin-owner AT cygwin DOT com |
Mail-Followup-To: | cygwin AT cygwin DOT com |
Delivered-To: | mailing list cygwin AT cygwin DOT com |
I have a Winsock provider DLL which communicates with a kernel SCTP stack. I'd like to enable applications built with both Visual Studio and Cygwin to run because there's lots of code that's been ported from Linux. However, the problem I've come across is that because I have a few custom socket functions such as sctp_sendmsg and sctp_recvmsg that don't go through the Winsock layer but still get a SOCKET descriptor, I get passed Cygwin's internal file descriptor - i.e. I can see my WSPAccept function returns a value of 161 up the stack but it gets translated to 4 by Cygwin's socket code, and the 161 value will be stored in the io_handle member of the fhandler_socket class. I thought I could maybe use GetFileType and _get_osfhandle to deal with running under Cygwin but it turns out that GetFileType tells me I have a valid handle, and converting it using _get_osfhandle anyway gives me an invalid handle back. Is there some way to detect that the handle's wrong and fetch the proper one without my code needing detailed knowledge of the fhandler_socket class? -- Bruce Cran -- Problem reports: http://cygwin.com/problems.html FAQ: http://cygwin.com/faq/ Documentation: http://cygwin.com/docs.html Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple
webmaster | delorie software privacy |
Copyright © 2019 by DJ Delorie | Updated Jul 2019 |