This is the mail archive of the cygwin 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] |
Other format: | [Raw text] |
I've run into a problem where getsockname() doesn't work as expected. Below is a test program where it fails under cygwin but runs on any other Unix/Linux system. I searched the mail archives for any limitationswell,,, not 'any' other linux system...
#include <sys/types.h> #include <sys/socket.h> #include <netinet/in.h> #include <stdio.h>
int main() {
struct sockaddr_in sa; socklen_t len = sizeof sa; int s, rc;
s = socket(AF_INET, SOCK_RAW, IPPROTO_ICMP); printf("socket = %d\nlength = %d\n", s, len);
rc = getsockname(s, (struct sockaddr *) &sa, &len); printf("getsockname rc = %d\nreturned length = %d\n", rc, len); perror("getsockname");
return rc;
}
$ ./getsockname socket = -1 length = 16 getsockname rc = -1 returned length = 16 getsockname: Bad file descriptor
[rthompso@wasteland /home/rthompso $ uname -a Linux wasteland 2.4.18-18.7.x #1 Wed Nov 13 20:29:30 EST 2002 i686 unknown
similar failed response on WinXP $ ./getsockname socket = 3 length = 16 getsockname rc = -1 returned length = 16 getsockname: Invalid argument WS-XP-4960[08:38:46]: /home/rthompso>
-- Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple Problem reports: http://cygwin.com/problems.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] |