delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2016/01/18/11:13:25

X-Recipient: archive-cygwin AT delorie DOT com
DomainKey-Signature: a=rsa-sha1; c=nofws; d=sourceware.org; h=list-id
:list-unsubscribe:list-subscribe:list-archive:list-post
:list-help:sender:date:from:to:subject:message-id:reply-to
:references:mime-version:content-type:in-reply-to; q=dns; s=
default; b=c83VS865Ok5g2vEf0ckGZsM5z8sClkRZcW+gn54eLPoINT6rlpL7l
YKXYRU4wyQ0CpsNbmnKEmZ/w4iMmWR7vpuApFuMPNbXb2BqRvEE0kNqJZXv4N5t8
7xedLyMRxh+FUgN47RZ+pk5ugmJKbforflMUQrK1g1VD69aRaoRcHg=
DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=sourceware.org; h=list-id
:list-unsubscribe:list-subscribe:list-archive:list-post
:list-help:sender:date:from:to:subject:message-id:reply-to
:references:mime-version:content-type:in-reply-to; s=default;
bh=voM5CXJMy1E4bY8o53kd9UXDhfM=; b=CDXkFOoz5HlG9ZUOh0ZwQSRbkXgM
P1vkf1NyEvmLvpgYSx/lc2/egSpT6RX1vC2W6alwwnc70DOP8JGF6fjJ950n6X0O
XFNwmzK6I1OJ47mj8CBF+cXNueiGhYyRzigt9yYUp3NcRi/Z9T6bP/gStzCMbsyc
BSNmzFo9PvPH+EM=
Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm
List-Id: <cygwin.cygwin.com>
List-Subscribe: <mailto:cygwin-subscribe AT cygwin DOT com>
List-Archive: <http://sourceware.org/ml/cygwin/>
List-Post: <mailto:cygwin AT cygwin DOT com>
List-Help: <mailto:cygwin-help AT cygwin DOT com>, <http://sourceware.org/ml/#faqs>
Sender: cygwin-owner AT cygwin DOT com
Mail-Followup-To: cygwin AT cygwin DOT com
Delivered-To: mailing list cygwin AT cygwin DOT com
Authentication-Results: sourceware.org; auth=none
X-Virus-Found: No
X-Spam-SWARE-Status: No, score=-93.4 required=5.0 tests=AWL,BAYES_05,KAM_LAZY_DOMAIN_SECURITY,KHOP_DYNAMIC,RCVD_IN_BRBL_LASTEXT,RCVD_IN_PBL,RDNS_DYNAMIC,USER_IN_WHITELIST autolearn=no version=3.3.2 spammy=Glen, H*MI:sk:1645435, H*f:sk:1645435, H*i:sk:1645435
X-HELO: calimero.vinschen.de
Date: Mon, 18 Jan 2016 17:13:04 +0100
From: Corinna Vinschen <corinna-cygwin AT cygwin DOT com>
To: cygwin AT cygwin DOT com
Subject: Re: Need tips to open a socket and to debug it
Message-ID: <20160118161304.GB21254@calimero.vinschen.de>
Reply-To: cygwin AT cygwin DOT com
Mail-Followup-To: cygwin AT cygwin DOT com
References: <956984971 DOT 4908269 DOT 1452966941574 DOT JavaMail DOT yahoo DOT ref AT mail DOT yahoo DOT com> <956984971 DOT 4908269 DOT 1452966941574 DOT JavaMail DOT yahoo AT mail DOT yahoo DOT com> <1645435954 DOT 1234364 DOT 1452968175143 DOT JavaMail DOT yahoo AT mail DOT yahoo DOT com>
MIME-Version: 1.0
In-Reply-To: <1645435954.1234364.1452968175143.JavaMail.yahoo@mail.yahoo.com>
User-Agent: Mutt/1.5.24 (2015-08-30)

--Kj7319i9nmIyA2yE
Content-Type: text/plain; charset=utf-8
Content-Disposition: inline
Content-Transfer-Encoding: quoted-printable

On Jan 16 18:16, Glen L wrote:
>=20
> Greetings all,
>=20
> 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:
>=20
>     if ((g->listen =3D socket(PF_LOCAL, SOCK_STREAM, 0)) < 0) {
>         fprintf(stderr, "Can't create socket: %d %s", (int) errno, strerr=
or(errno));
>         return -1;
>     }
>=20
> The code is built for 64-bit windows using this:
> x86_64-pc-cygwin-gcc -g --std=3Dgnu99 -O0 -DGLUT_DISABLE_ATEXIT_HACK -nos=
tdinc -march=3Dcore2 -m64
>=20
>=20
> 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
>=20
> 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 =3D 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

--=20
Corinna Vinschen                  Please, send mails regarding Cygwin to
Cygwin Maintainer                 cygwin AT cygwin DOT com
Red Hat

--Kj7319i9nmIyA2yE
Content-Type: application/pgp-signature; name="signature.asc"

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v2

iQIcBAEBCAAGBQJWnQ8QAAoJEPU2Bp2uRE+g3hAP/2eXAtdkR+SsznZQCKfoNBIL
dTW4kO7zTKUl3KsTwDjoTDBzxx+A0ketjHCYeFGliLX4K8uk4XObY6rGErjLYp5r
q0NIHIizqkK19A+/teBPjnxId6VKBvN6hGKiz8sMX/CI5Oc3dFC4px+F1SS7cR6Y
sgxrdSrFYeNXUiUUH3xvA1lqT00aipAzew3hY01EmKF5SIJGWopcHaQubAMHiT8N
FEJ7bZfTqd1OBULHIUR8npftqBsmD7SjPbG62kG8z2yRF3NSfuemv9/mV8okOBdX
6xcdmh6I6QtfciXCdfKdO4nRcTwD/lsFqyWBpqB+URXRMF6o9JajM5DfIdluJKqn
pOcqrKDSkJrMyBk7cl+jNa1DM9JZOXCjZFRVstZgxP9gj8/t95Dct9jZCiWQOCx7
VFtC46+Z3+uByYt88aFjwiaZaY3vFsD86AZy04ATiE0zb0vOk/AWWlAffo+/MNvr
vOvP7JPIvA2Bt5b2WRBaYfBaueOC8vpBJAyfdLa6Yv1xu2Es4lt7MrWWY53nFG4m
eHkMjf6pjEQ6HoTNiEpVedYMuRgbEPsoXjrFWY+ji3gXxL4W0HrHts9O1GNPfYwt
lQHNaWzKCgAbA2L8hq6I53qzTZm3fn9ohlhgNeZBbrU63Wxdw+k5vN6JtUMjO9mc
L5gNUwwPuDXF9BHE3Ok+
=bOu7
-----END PGP SIGNATURE-----

--Kj7319i9nmIyA2yE--

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019