* Need tips to open a socket and to debug it [not found] ` <956984971.4908269.1452966941574.JavaMail.yahoo@mail.yahoo.com> @ 2016-01-16 20:00 ` Glen L 2016-01-18 18:10 ` Corinna Vinschen 0 siblings, 1 reply; 6+ messages in thread From: Glen L @ 2016-01-16 20:00 UTC (permalink / raw) To: cygwin Greetings all, I'm moving a "C" program to 64-bit Windows 10 that worked previously in 32-bit Win7. It builds, compiles and runs (AFAIK) with the exception of being able to open a socket. Calling the socket thusly: if ((g->listen = socket(PF_LOCAL, SOCK_STREAM, 0)) < 0) { fprintf(stderr, "Can't create socket: %d %s", (int) errno, strerror(errno)); return -1; } The code is built for 64-bit windows using this: x86_64-pc-cygwin-gcc -g --std=gnu99 -O0 -DGLUT_DISABLE_ATEXIT_HACK -nostdinc -march=core2 -m64 The result, however, is ENOENT and "No such file or directory." uname -a : CYGWIN_NT-10.0 LAPTOP-B8KN061R 2.4.0(0.293/5/3) 2016-01-15 16:16 x86_64 Cygwin I've tried a few things with the firewall and looked for internet tips. No luck, clearly. So, I had the idea to step into the socket call and see what's going on. ENOENT seems a bit weird. I'm using Eclipse and gdb for this and it's working fine, with source, for the application. I can step around the machine code for the cygwin calls but no source. I've tried downloading the source files and debug info but I'm perplexed as to making that work. I don't seem to be finding the source files by hand that look like the machine code. Can someone point me to a good reference on how to debug the distributed cygwin libraries? I would seem to be supported but I'm just not getting how to point to the sources and debug info from gdb. Thanks for any and all support. Glen -- 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 ^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: Need tips to open a socket and to debug it 2016-01-16 20:00 ` Need tips to open a socket and to debug it Glen L @ 2016-01-18 18:10 ` Corinna Vinschen 2016-01-18 19:50 ` Henri 0 siblings, 1 reply; 6+ messages in thread From: Corinna Vinschen @ 2016-01-18 18:10 UTC (permalink / raw) To: cygwin [-- Attachment #1: Type: text/plain, Size: 2466 bytes --] On Jan 16 18:16, Glen L wrote: > > Greetings all, > > I'm moving a "C" program to 64-bit Windows 10 that worked previously > in 32-bit Win7. It builds, compiles and runs (AFAIK) with the > exception of being able to open a socket. Calling the socket thusly: > > if ((g->listen = socket(PF_LOCAL, SOCK_STREAM, 0)) < 0) { > fprintf(stderr, "Can't create socket: %d %s", (int) errno, strerror(errno)); > return -1; > } > > The code is built for 64-bit windows using this: > x86_64-pc-cygwin-gcc -g --std=gnu99 -O0 -DGLUT_DISABLE_ATEXIT_HACK -nostdinc -march=core2 -m64 > > > The result, however, is ENOENT and "No such file or directory." > uname -a : CYGWIN_NT-10.0 LAPTOP-B8KN061R 2.4.0(0.293/5/3) 2016-01-15 16:16 x86_64 Cygwin > > I've tried a few things with the firewall and looked for internet > tips. No luck, clearly. There's no firewall involved if a simple socket call goes wrong. For AF_LOCAL Cygwin opens an AF_INET socket, but which is unbound until you call bind or connect. I tried this myself and it works for me: $ uname -srvm CYGWIN_NT-10.0 2.4.0(0.293/5/3) 2016-01-15 16:16 x86_64 $ cat <<EOF > sock.c #include <sys/types.h> /* See NOTES */ #include <sys/socket.h> #include <errno.h> #include <stdio.h> #include <string.h> int main() { int fd = socket (AF_LOCAL, SOCK_STREAM, 0); if (fd < 0) { fprintf (stderr, "Can't create socket: %d %s", errno, strerror (errno)); return -1; } printf ("Success\n"); return 0; } EOF $ gcc -g -o sock sock.c $ ./sock Success > So, I had the idea to step into the socket call and see what's going > on. ENOENT seems a bit weird. I'm using Eclipse and gdb for this and > it's working fine, with source, for the application. I can step around > the machine code for the cygwin calls but no source. I've tried > downloading the source files and debug info but I'm perplexed as to > making that work. I don't seem to be finding the source files by hand > that look like the machine code. You don't need to install the source package. When you installed the cygwin-debuginfo file, the debug files are installed into /usr/lib/debug/ and the sources under /usr/src/debug/cygwin-2.4.0-1/ Corinna -- Corinna Vinschen Please, send mails regarding Cygwin to Cygwin Maintainer cygwin AT cygwin DOT com Red Hat [-- Attachment #2: signature.asc --] [-- Type: application/pgp-signature, Size: 819 bytes --] ^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: Need tips to open a socket and to debug it 2016-01-18 18:10 ` Corinna Vinschen @ 2016-01-18 19:50 ` Henri 2016-01-18 21:06 ` Corinna Vinschen 0 siblings, 1 reply; 6+ messages in thread From: Henri @ 2016-01-18 19:50 UTC (permalink / raw) To: cygwin Corinna Vinschen <corinna-cygwin <at> cygwin.com> writes: > There's no firewall involved if a simple socket call goes wrong. > For AF_LOCAL Cygwin opens an AF_INET socket, but which is unbound > until you call bind or connect. s/AF_INET/AF_UNIX/ ????? (sorry for my intrusion) Regards, Henri -- 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 ^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: Need tips to open a socket and to debug it 2016-01-18 19:50 ` Henri @ 2016-01-18 21:06 ` Corinna Vinschen 2016-01-19 13:39 ` Henri 0 siblings, 1 reply; 6+ messages in thread From: Corinna Vinschen @ 2016-01-18 21:06 UTC (permalink / raw) To: cygwin [-- Attachment #1: Type: text/plain, Size: 612 bytes --] On Jan 18 18:10, Henri wrote: > Corinna Vinschen <corinna-cygwin <at> cygwin.com> writes: > > > There's no firewall involved if a simple socket call goes wrong. > > For AF_LOCAL Cygwin opens an AF_INET socket, but which is unbound > > until you call bind or connect. > > s/AF_INET/AF_UNIX/ ????? (sorry for my intrusion) AF_UNIX == AF_LOCAL. Not available on Windows so needs emulation. The emulation uses local-only AF_INET sockets. Corinna -- Corinna Vinschen Please, send mails regarding Cygwin to Cygwin Maintainer cygwin AT cygwin DOT com Red Hat [-- Attachment #2: signature.asc --] [-- Type: application/pgp-signature, Size: 819 bytes --] ^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: Need tips to open a socket and to debug it 2016-01-18 21:06 ` Corinna Vinschen @ 2016-01-19 13:39 ` Henri 2016-01-19 13:51 ` Corinna Vinschen 0 siblings, 1 reply; 6+ messages in thread From: Henri @ 2016-01-19 13:39 UTC (permalink / raw) To: cygwin Corinna Vinschen <corinna-cygwin <at> cygwin.com> writes: > > On Jan 18 18:10, Henri wrote: > > Corinna Vinschen <corinna-cygwin <at> cygwin.com> writes: > > > > > There's no firewall involved if a simple socket call goes wrong. > > > For AF_LOCAL Cygwin opens an AF_INET socket, but which is unbound > > > until you call bind or connect. > > > > s/AF_INET/AF_UNIX/ ????? (sorry for my intrusion) > > AF_UNIX == AF_LOCAL. Not available on Windows so needs emulation. > The emulation uses local-only AF_INET sockets. You are correct ... I simply misread your communication. What POSIX refers to as AF_LOCAL, and SUSv3 refers to as AF_UNIX, is an 'Unix Domain socket' ... and of course, that type of socket needs to be emulated on Windows. Clear. Sorry for the noise ... Henri -- 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 ^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: Need tips to open a socket and to debug it 2016-01-19 13:39 ` Henri @ 2016-01-19 13:51 ` Corinna Vinschen 0 siblings, 0 replies; 6+ messages in thread From: Corinna Vinschen @ 2016-01-19 13:51 UTC (permalink / raw) To: cygwin [-- Attachment #1: Type: text/plain, Size: 1086 bytes --] On Jan 19 08:48, Henri wrote: > Corinna Vinschen <corinna-cygwin <at> cygwin.com> writes: > > On Jan 18 18:10, Henri wrote: > > > Corinna Vinschen <corinna-cygwin <at> cygwin.com> writes: > > > > > > > There's no firewall involved if a simple socket call goes wrong. > > > > For AF_LOCAL Cygwin opens an AF_INET socket, but which is unbound > > > > until you call bind or connect. > > > > > > s/AF_INET/AF_UNIX/ ????? (sorry for my intrusion) > > > > AF_UNIX == AF_LOCAL. Not available on Windows so needs emulation. > > The emulation uses local-only AF_INET sockets. > > You are correct ... I simply misread your communication. > > What POSIX refers to as AF_LOCAL, and SUSv3 refers to as AF_UNIX, is > an 'Unix Domain socket' ... and of course, that type of socket needs > to be emulated on Windows. > > Clear. Sorry for the noise ... No worries, it's better asking if something's unclear. Corinna -- Corinna Vinschen Please, send mails regarding Cygwin to Cygwin Maintainer cygwin AT cygwin DOT com Red Hat [-- Attachment #2: signature.asc --] [-- Type: application/pgp-signature, Size: 819 bytes --] ^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2016-01-19 8:54 UTC | newest] Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed) -- links below jump to the message on this page -- [not found] <956984971.4908269.1452966941574.JavaMail.yahoo.ref@mail.yahoo.com> [not found] ` <956984971.4908269.1452966941574.JavaMail.yahoo@mail.yahoo.com> 2016-01-16 20:00 ` Need tips to open a socket and to debug it Glen L 2016-01-18 18:10 ` Corinna Vinschen 2016-01-18 19:50 ` Henri 2016-01-18 21:06 ` Corinna Vinschen 2016-01-19 13:39 ` Henri 2016-01-19 13:51 ` Corinna Vinschen
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox; as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).