From owner-freebsd-questions Wed Aug 21 12: 4:31 2002 Delivered-To: freebsd-questions@freebsd.org Received: from mx1.FreeBSD.org (mx1.FreeBSD.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 33E3037B400 for ; Wed, 21 Aug 2002 12:04:28 -0700 (PDT) Received: from dan.emsphone.com (dan.emsphone.com [199.67.51.101]) by mx1.FreeBSD.org (Postfix) with ESMTP id AE3EF43E3B for ; Wed, 21 Aug 2002 12:04:27 -0700 (PDT) (envelope-from dan@dan.emsphone.com) Received: (from dan@localhost) by dan.emsphone.com (8.12.5/8.12.5) id g7LJ4ROd039690; Wed, 21 Aug 2002 14:04:27 -0500 (CDT) (envelope-from dan) Date: Wed, 21 Aug 2002 14:04:27 -0500 From: Dan Nelson To: Gianmarco Giovannelli Cc: questions@FreeBSD.ORG Subject: Re: Porting from win32 to UNIX: Sockets Message-ID: <20020821190426.GD97484@dan.emsphone.com> References: <5.1.1.6.2.20020821204121.02ad7008@194.184.65.4> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <5.1.1.6.2.20020821204121.02ad7008@194.184.65.4> X-OS: FreeBSD 5.0-CURRENT X-message-flag: Outlook Error User-Agent: Mutt/1.5.1i Sender: owner-freebsd-questions@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.ORG In the last episode (Aug 21), Gianmarco Giovannelli said: > Hi a friend of mine involved in a porting project. > He has asking me something about socket and more I am not able to answer > :-) > > Thanks for your attention... > > --- begin --- > > [...] > that are familiar with "low-level-TCP/IP" coding. > plz help > > following problem: > I don't know how to get an errorcode in case of socket-operation failed > (send/recv) > in windows it goes like this > > e.g > res = send(....); > if (res==SOCKET_ERROR) > { > err = WSAGetLastError(); > if (err==....) ...; > } > > but how to do this in linux/UNIX/BSD ? > what's the equivalent of WSAGetLastError ? On Unix, the send function returns -1, and the error is stored in the global 'errno' variable. "man errno" for more information. -- Dan Nelson dnelson@allantgroup.com To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-questions" in the body of the message