Mailing-List: contact cygwin-help AT sourceware DOT cygnus DOT com; run by ezmlm List-Subscribe: List-Archive: List-Post: List-Help: , Sender: cygwin-owner AT sources DOT redhat DOT com Delivered-To: mailing list cygwin AT sources DOT redhat DOT com Date: Thu, 11 Oct 2001 14:08:09 +0400 From: egor duda X-Mailer: The Bat! (v1.53 RC/4) Reply-To: egor duda Organization: deo X-Priority: 3 (Normal) Message-ID: <138167630259.20011011140809@logos-m.ru> To: "Alexandr V.Shutko" CC: cygwin AT cygwin DOT com Subject: Re: [AVShutko AT mail DOT khstu DOT ru: Re: BUG in sendto() function] In-Reply-To: <148618535106.20011011155732@mail.khstu.ru> References: <20011010002737 DOT B16038 AT redhat DOT com> <16470545989 DOT 20011010111003 AT logos-m DOT ru> <148618535106 DOT 20011011155732 AT mail DOT khstu DOT ru> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Hi! Thursday, 11 October, 2001 Alexandr V. Shutko AVShutko AT mail DOT khstu DOT ru wrote: AVS> Hello egor, AVS> Wednesday, October 10, 2001, 6:10:03 PM, you wrote: ed>> yes, it should work, testcase is correct. but i doubt it _ever_ worked ed>> in cygwin. the problem is not with socket. socket is ok. but sendto() ed>> gets dest_addr parameter of type 'struct sockaddr'. we pass this ed>> parameter to WSASendTo() as is, and it works ok while this sockaddr is ed>> of AF_INET family, which WSASendTo() supports. but in this example ed>> it's AF_UNIX. unfortunately, right now I can't propose any solution ed>> except "you can't do that" :( AVS> Well, I find function in net.cc named get_inet_addr that convert unix AVS> address to WSA... AVS> ######################################################################### AVS> static int get_inet_addr (const struct sockaddr *in, int inlen, AVS> struct sockaddr_in *out, int *outlen, int* secret = 0) AVS> ######################################################################### >>From your words I understand that sendto() can't use this function to AVS> convert address... is it true ? Gosh, it looks like i was just plain stupid yesterday when i was looking at the code. everything is simpler than i thought. get_inet_addr works ok, the problem is nobody uses data it returns. i've just checked in the simple fix. you can either update sources from cvs and rebuild or wait for next snapshot. Be warned, however, that there still is a problem with recvfrom() on AF_UNIX socket. recvfrom() is supposed to return peer address, if caller supplies a buffer for that. Cygwin emulates AF_UNIX sockets via AF_INET ones, so real recvfrom() is done from inet address. so, here's the problem: mapping from AF_UNIX socket to AF_INET is simple -- just open a AF_UNIX socket file, read port number from it and open appropriate AF_INET socket. but in case of recvfrom() we need reverse mapping -- from port number to file name. Cygwin cannot do the latter currently. Egor. mailto:deo AT logos-m DOT ru ICQ 5165414 FidoNet 2:5020/496.19 -- Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple Bug reporting: http://cygwin.com/bugs.html Documentation: http://cygwin.com/docs.html FAQ: http://cygwin.com/faq/