From owner-freebsd-questions Tue Feb 6 3:30:56 2001 Delivered-To: freebsd-questions@freebsd.org Received: from what.ifelse.org (what.ifelse.org [208.171.40.202]) by hub.freebsd.org (Postfix) with ESMTP id EBBFE37B401 for ; Tue, 6 Feb 2001 03:30:38 -0800 (PST) Received: from 2416419hfc44.tampabay.rr.com (2416419hfc44.tampabay.rr.com [24.164.19.44]) by what.ifelse.org (8.9.3/8.9.3/Debian 8.9.3-21) with ESMTP id GAA25164 for ; Tue, 6 Feb 2001 06:17:49 -0500 Date: Tue, 6 Feb 2001 06:32:14 -0500 (EST) From: bill X-X-Sender: To: Subject: getsockname + getnameinfo = garbage Message-ID: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=X-UNKNOWN Content-Transfer-Encoding: QUOTED-PRINTABLE Sender: owner-freebsd-questions@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.ORG Hello, I'm using xawtv-3.30 on freebsd and it uses this function to get the name of the server and the client: /* me */ length =3D sizeof(ss); if (-1 =3D=3D getsockname(fd,(struct sockaddr*)&ss,&length)) { perror("getsockname"); return; } if (debug) fprintf(stderr,"*"); getnameinfo((struct sockaddr*)&ss,length, me,INET6_ADDRSTRLEN,port,16, NI_NUMERICHOST | NI_NUMERICSERV); if (debug) fprintf(stderr,"*"); for variables 'me' and 'peer'. it then compares 'me' and 'peer' to check if the X server is local. This check always fails because it seems that these functions return this garbage: This is xawtv-3.30, running on FreeBSD/i386 (4.2-STABLE) [...] check if the X-Server is local ... **** ok x11 socket: me=3D8=90=04=08(S=08=01, server=3D=9A`=07(=9F=A1=04=08=A8=C3,( I get xawtv to work by ensuring that the results of this check don't matter. In the man page for getsockname(2), the BUGS section mentions: Names bound to sockets in the UNIX domain are inaccessible; getsockname returns a zero length name. Being a C beginner, I am curious if this is what could be causing the garbage, and if so is there a way to work around it? I have seen this happen on another, completely different freebsd box, but it doesn't happen on Linux. Thanks for any info, Bill To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-questions" in the body of the message