From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on polar.synack.me X-Spam-Level: X-Spam-Status: No, score=-1.3 required=5.0 tests=BAYES_00,INVALID_MSGID autolearn=no autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,c8b574b34e9605de X-Google-Attributes: gid103376,public From: Nasser Subject: Re: Ada 95 Sockets example wanted Date: 1997/08/19 Message-ID: <5tdvo7$3ff@drn.zippo.com>#1/1 X-Deja-AN: 268164872 References: <33F35E0C.6800@vfb23.mds.lmco.com> Organization: None Newsgroups: comp.lang.ada Date: 1997-08-19T00:00:00+00:00 List-Id: In article , dewar@merv.cs.nyu.edu says... > >Marc asks > ><basics of Unix socket manipulation: open, close, read, and write. >I've never had to get down to the low-level interaction with >sockets, having been able to use various layering packages on >top of them.>> > >One source of sample code is the code for GLADE, the PCS for Ada >distribution from ACT/Europe. This PCS uses sockets for communication, >and of course the sources are available for looking at! > One thing I noticed just browsing the GLADE code is that when a socket-related operation failes, a generic Communication_Error exception is raised. In C, one normally reads the value of the global error number, to tell specifically what the erorr was on the last call. this is example from GLADE: "FD := C_Socket (Af_Inet, Sock_Stream, 0); if FD = Failure then Free (Sin); Free (Check); raise Communication_Error; end if;" another example: "if C_Bind (FD, To_Sockaddr_Access (Sin), Sin.all'Size / 8) = Failure then Free (Sin); Free (Check); raise Communication_Error;" My question is then, how would the client know the exact error number, i.e. the reason why the call failed if one just raises a generic exception? or a more general question, can one from gnat get hold of the errno set by calls into C library such as the socket examples above? thanks, Nasser