Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 21 Aug 2002 14:04:27 -0500
From:      Dan Nelson <dnelson@allantgroup.com>
To:        Gianmarco Giovannelli <gmarco@giovannelli.it>
Cc:        questions@FreeBSD.ORG
Subject:   Re: Porting from win32 to UNIX: Sockets
Message-ID:  <20020821190426.GD97484@dan.emsphone.com>
In-Reply-To: <5.1.1.6.2.20020821204121.02ad7008@194.184.65.4>
References:  <5.1.1.6.2.20020821204121.02ad7008@194.184.65.4>

next in thread | previous in thread | raw e-mail | index | archive | help
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




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20020821190426.GD97484>