Mailing-List: contact cygwin-help@sourceware.cygnus.com; run by ezmlm List-Subscribe: List-Archive: List-Post: List-Help: , Sender: cygwin-owner@sources.redhat.com Delivered-To: mailing list cygwin@sources.redhat.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@cygwin.com Subject: Re: [AVShutko@mail.khstu.ru: Re: BUG in sendto() function] In-Reply-To: <148618535106.20011011155732@mail.khstu.ru> References: <20011010002737.B16038@redhat.com> <16470545989.20011010111003@logos-m.ru> <148618535106.20011011155732@mail.khstu.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@mail.khstu.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@logos-m.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/