This is the mail archive of the cygwin@cygwin.com mailing list for the Cygwin project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Re: [AVShutko@mail.khstu.ru: Re: BUG in sendto() function]


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/


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]