home *** CD-ROM | disk | FTP | other *** search
- Newsgroups: rec.games.mud.misc
- Path: sparky!uunet!paladin.american.edu!gatech!darwin.sura.net!ra!wintermute.phys.psu.edu!atlantis.psu.edu!handel!stine
- From: stine@handel.psu.edu (Jeffrey Stine)
- Subject: Re: Note to any fellow DikuMUD coders...
- Message-ID: <jck1H8e5mb@atlantis.psu.edu>
- Sender: news@atlantis.psu.edu (Usenet)
- Organization: Penn State University
- References: <3331@bsu-cs.bsu.edu> <1992Dec24.114107.18992@meiko.com>
- Date: Thu, 24 Dec 92 23:21:42 GMT
- Lines: 23
-
- In article <1992Dec24.114107.18992@meiko.com> gordon@meiko.com (Gordon Henderson) writes:
- >In article <3331@bsu-cs.bsu.edu> decker@bsu-cs.bsu.edu (Alexus Mel Lynn) writes:
- >>
- >>Have any of you fellow coders worked with getpeername? (I've ported some
- >>lpmud code over my very hacked diku, but it always dies on the getpeername...)
- >>
- >>I've made sure it's not something stupid like bad parameters, etc.
- >
- >I use this in a MUD that I am running to get the ip address of the caller:
- [...(code using getpeername snipped)]
- >--
- > Gordon (Irn-Bru) Henderson
- >
- Throw it out. Get rid of all that code that uses getpeername().
- Why waste a system call on something that accept() will do for you?
- If you are using a connection oriented, single process server there
- is no reason why you shouldn't get the info you need from accept().
-
- int accept(int sockfd, struct sockaddr *peer, int *addrlen);
-
- It will complete the 5-tuple association with foreign address just like
- the getpeername call. getpeername is primarily needed in applications
- called by inetd, which does the accept for them.
-