home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #19 / NN_1992_19.iso / spool / comp / unix / programm / 4451 < prev    next >
Encoding:
Text File  |  1992-08-26  |  2.1 KB  |  52 lines

  1. Newsgroups: comp.unix.programmer
  2. Path: sparky!uunet!mcsun!Germany.EU.net!Urmel.Informatik.RWTH-Aachen.DE!physik.tu-muenchen.de!berg
  3. From: berg@physik.tu-muenchen.de (Stephen R. van den Berg)
  4. Subject: getservbyname(), getprotobyname(), gethostbyname()
  5. Message-ID: <1992Aug26.134713.29684@Urmel.Informatik.RWTH-Aachen.DE>
  6. Originator: berg@tabaqui
  7. Sender: news@Urmel.Informatik.RWTH-Aachen.DE (Newsfiles Owner)
  8. Nntp-Posting-Host: tabaqui
  9. Organization: Rechnerbetrieb Informatik  /  RWTH Aachen
  10. References: <1992Aug26.133119.29254@Urmel.Informatik.RWTH-Aachen.DE>
  11. Date: Wed, 26 Aug 92 13:47:13 GMT
  12. Lines: 38
  13.  
  14. It's me again, sorry, but these portability problems always seem to
  15. come in herds :-).
  16.  
  17. Let me explain the problem here.  I have this program (procmail) which is
  18. trying to double as a /bin/mail substitute.  Now, the only thing that I yet
  19. have to mimick is the biff/comsat notification which /bin/mail normally does.
  20.  
  21. Now, in order to that, I have to find out the following:
  22.  
  23.     1. gethostbyname("localhost.or.something.else")
  24.     2. getservbyname("biff")
  25.     3. getprotobyname("UDP")
  26.  
  27. Well, so far so good, the only trouble is, these calls are done every time
  28. when mail arrives.  I was wondering, what is common practice in this case?
  29.  
  30.     a. Go by the book and make all three calls at runtime?
  31.     b. Do 1. and 2. at runtime, 3. at compile time?
  32.     c. Do 1. at runtime, 2. and 3. at compile time?
  33.     d. Do all three at compile time?  (By compile-time I mean: compile
  34.        a separate program that makes these calls, and then use the output
  35.        from this program to hardcode the number(s) in the real program).
  36.        
  37. I personally like a., but I might suspect some performance penalty here
  38. (depending on the configuration every one of these calls causes several files
  39. to be opened and miscellaneous network-traffic to be generated).
  40.  
  41. As a reasonable compromise I suspect that b. is the most eligible, since
  42. the protocol number for UDP is not likely to change, is it?
  43.  
  44. What would you consider acceptable practice?
  45.  
  46. Thanks.
  47. -- 
  48. Sincerely,                                  berg@pool.informatik.rwth-aachen.de
  49.            Stephen R. van den Berg (AKA BuGless).    berg@physik.tu-muenchen.de
  50.  
  51. "Good moaning!"
  52.