Socket Questions

Michael I. Bushnell mike at turing.unm.edu
Mon Oct 10 19:10:18 AEST 1988


In article <9000010 at m.cs.uiuc.edu> totty at m.cs.uiuc.edu writes:

>	I have some questions about sockets that maybe I
>	can get answers to...

I'll try...

>	1) Is there a book that describes sockets?  The Sun
>	   man pages I have are not enough.

4.3 BSD comes with the documents:

An Introductory 4.3BSD Interprocess Communication Tutorial
Advanced 4.3BSD IPC Tutorial

You could probably find something similar in your Sun manual set.

>	2) Using a connected stream will send block until
>	   it is able to send all of its data?  I have a
>	   program where send will return but only having
>	   sent some of the data.  The length field returns
>	   the # of bytes sent, but I thought send returned
>	   only when all data had been sent...

You should check the return value of write() to see how much data has
actually been sent.  There is no guarantee that the full amount will
be sent.

>	3) When I close a socket, the select() call on the
>	   other end thinks it is ready to be read.  Is
>	   this what is supposed to happen?  How does the
>	   other end know when the remote socket closed
>	   the connection?  Is there an end-of-file status?

Select() is actually telling you that it can be read without blocking.
If you actually go ahead and read it, you will read 0 bytes, which
indicates EOF.


                N u m q u a m   G l o r i a   D e o 

       \                Michael I. Bushnell
        \               HASA - "A" division
        /\              mike at turing.unm.edu
       /  \ {ucbvax,gatech}!unmvax!turing.unm.edu!mike



More information about the Comp.unix.questions mailing list