Path: utzoo!mnetor!tmsoft!torsqnt!hybrid!scifi!bywater!uunet!infonode!tensmekl From: tensmekl@infonode.ingr.com (Kermit Tensmeyer) Newsgroups: comp.unix.internals Subject: Re: Wizard-level questions Message-ID: <1991Jan27.234017.19270@infonode.ingr.com> Date: 27 Jan 91 23:40:17 GMT References: <16048@sdcc6.ucsd.edu> Organization: Intergraph Corp. Huntsville, AL Lines: 56 In article <16048@sdcc6.ucsd.edu> cs163wcr@sdcc10.ucsd.edu -- Steve Boswell writes: >I have been hacking at these questions for a while, using various >reference books, with no real progress. Could someone please tell >me: > >[2] With Internet sockets, how does a machine accept()ing a > socket connection know what machine is calling it? Does > it rely on the calling program to tell it? > >I'm on 4.3 BSD Tahoe & the Internet, if that helps. > >Steve Boswell >whatis@ucsd.edu There is a function in the BSD suite of TCP/IP that has the following setup int recvfrom (s, buf, len, flags, from, fromlen) int s, len, flags; char *buf; struct sockaddr *from; int *fromlen; The structure Sockaddr contains the return address (Type IV address and Port number from which is was sent. This of course works in the datagram mode. When the connection is in the "connected mode" use the recv call. For further information, look up recv(2) and connect(2) in the man pages. --- All the wizards that I used to know and from whom I learned my craft have seemed to have gotten out of the bussines. Most of the folk who are still willing to try know the areas of the business that have given them problems, .. there is just to much to know. The books on my desk that sometimes get open are: Maurice Bach The Design of the UNIX Operating System Nemeth,Snyder,Seebass Unix System Adminstration Handbook Egain, Teixeira Writing A Unix Device Driver Schreiner Using C with Curses, Lex, and Yacc Kochan, Wood Unix Shell Programming Ellis, Stroustrup The Annotated C++ Reference Manual --- -- Kermit Tensmeyer | Intergraph Corporation UUCP: ...uunet!ingr!tensmekl | One Madison Industrial Park INTERNET: tensmekl@ingr.com | Mail Stop LR23A2 AT&T: (205)730-8127 | Huntsville, AL 35807-4201