home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1993 #1 / NN_1993_1.iso / spool / comp / sys / sgi / 18671 < prev    next >
Encoding:
Internet Message Format  |  1993-01-11  |  3.6 KB

  1. Xref: sparky comp.sys.sgi:18671 comp.unix.admin:7028 comp.unix.internals:2111 comp.unix.misc:4916 comp.unix.bsd:11122
  2. Path: sparky!uunet!zaphod.mps.ohio-state.edu!usc!howland.reston.ans.net!spool.mu.edu!olivea!sgigate!sgi!rhyolite!vjs
  3. From: vjs@rhyolite.wpd.sgi.com (Vernon Schryver)
  4. Newsgroups: comp.sys.sgi,comp.unix.admin,comp.unix.internals,comp.unix.misc,comp.unix.bsd
  5. Subject: Re: Problem to transfer large data via socket communication - Need Help
  6. Message-ID: <uoe12m0@rhyolite.wpd.sgi.com>
  7. Date: 11 Jan 93 17:09:24 GMT
  8. References: <1993Jan8.071612.13716@news.uni-stuttgart.de> <1993Jan11.133545.16876@cc.ic.ac.uk>
  9. Organization: Silicon Graphics, Inc.  Mountain View, CA
  10. Lines: 63
  11.  
  12. In article <1993Jan11.133545.16876@cc.ic.ac.uk>, vulture@imperial.ac.uk (Thomas Sippel - Dau) writes:
  13. > In article <1993Jan8.071612.13716@news.uni-stuttgart.de>, wnkretz@ikesg1.energietechnik.uni-stuttgart.de (Oliver Kretzschmar) writes:
  14. > .....
  15. > -   to send data from socket to socket (stream):
  16. > - 
  17. > -         write(socket,(char*)data,buffer)
  18. > -         read(socket,(char*)data,buffer)
  19. > - 
  20. > -   But now we've problems sending/receiving large data for
  21. > -   example 50*50*50 matrix of floats or larger. Is there any
  22. > -   transfer-bufferlimitation by using streamsockets, that we can
  23. > -   manipulate ?
  24. > Yes, there is a number of streams buffers configured in the kernel, see 
  25. > (on IRIX) /usr/sysgen/master.d/kernel.
  26.  
  27. No, the number of streams buffers configured in the Silicon Graphics
  28. version of UNIX, "IRIX", have absolutely nothing to do with such
  29. uses of TCP/IP.  IRIX uses STREAMS buffers only for the MIDI and some
  30. audio code, the keyboard, and some other serial I/O devices.
  31.  
  32. Under certain circumstances, the number of MBUFs can affect pure TCP/IP
  33. uses, but almost certainly none concerning the original questioner.
  34.  
  35. The use of both mbufs and STREAMS buffers, events and queues can
  36. be monitored with `netstat`.  However, that is almost their only
  37. connection in IRIX.  Other versions of UNIX, especially those using
  38. STREAMS based TCP/IP are different from IRIX, which includes fairly
  39. recent versions of 4.3BSD style network code--i.e. "sockets".
  40.  
  41.  
  42. > However, you main error is to use read/write, which is for "unbuffered"
  43. > I/O and has generally been designed to be fast and for people who know
  44. > what they are doing and are willing to cope with hardware limitations 
  45. > themselves.
  46. > For applications programers the latter is not generally true, so use 
  47. > fread/fwrite and swallow the extra layer of software for the benefit
  48. > of generality.
  49.  
  50.  
  51. In general, UNIX hides all considerations of "hardware limitations"
  52. from application programmers.  The need to use various hacks like
  53. "physio" to get to the hardware is both an advantage and disadvange of
  54. most varients of UNIX.
  55.  
  56. Stdio would add a very costly layer in such an application as I
  57. understood to be the original questioner's.  Stdio would require at
  58. least one extra copy of the data.  Since the current IRIX version of
  59. stdio defines BUFSIZ to be 8K, the reads and writes of the application
  60. might be much smaller.  As wrote recently, 8K buffers are "below the
  61. knee" of the pure TCP/IP performance curve of IRIX, at least on fast
  62. media such as FDDI.
  63.  
  64. The fread() and fwrite() functions of the stdio package in IRIX does no
  65. more than some simple buffering on top of the read() and write() system
  66. calls.  One generally uses fread() and fwrite() only when performance
  67. is not an issue, and either when you don't want to deal with the short
  68. read()'s caused by the nature of TCP/IP or when you are also using
  69. formatting or scanning functions such fprintf() or fscanf().
  70.  
  71.  
  72. Vernon Schryver,  vjs@sgi.com
  73.