CSE 190 Sp 2000 -- Assignment 4 -- May 25, 2000

Take yaish from assignment 2 -- you may use the sample solution code -- and add the following commands:
socket symname service@hostname Creates a socket and associate it with the symbolic name symname in the same manner that the pipe command did. Connect this socket with the host hostname at the TCP port specified by service. Here service may be either a numeric port specifier or a symbolic one, in which case getservbyname is used to lookup the service in /etc/services.
sclose symname how If how is omitted, close the socket and disassociate the symbolic name symname from it. If how is specified, it must be 0, 1, or 2, and the socket is shut down (see shutdown(3n)) with that argument. A socket shutdown with a how of 2, or shutdown both 0 and 1 separately will have both send and receive sides shut down, and should free up the symbolic name. A half-shutdown socket should not free up the symbolic name.
The intention is that the symbolic names can be used in the same way as the pipe names already introduced. The symbolic names are in the same name space, so creating a socket with a symbolic name alrady in used by a pipe would be an error.

You may test out your implementation by using a simple server that I'm running on 7000@play.ucsd.edu:

$ netd -p 7000 -- cat
(You can run such a server yourself.)

You can, for example, run:

Y$ socket s 7000@play.ucsd.edu
Y$ cat somefile >| s &
Y$ sclose s 1
Y$ cat <| s
contents of ``somefile''
Y$ sclose s

More creatively, we could run:

$ netd -p 7001 -- seussify
and run:
Y$ socket s 7001@play.ucsd.edu
Y$ cat green_eggs >| s &
Y$ sclose s 1
Y$ cat <| s
edited contents of the file green_eggs
Y$ sclose s


Grade distribution


38 students handed in assignment 4.

assignment 4 as a whole: mean  74.3421
                         stdev 23.9124

w/o late adjustment: mean  74.3421
                     stdev 23.9124

Excluding all-zero scores:

assignment 4 as a whole: mean  80.7143
                         stdev 10.3194

w/o late adjustment: mean  80.7143
                     stdev 10.3194

Per-problem statistics:

Num  1:  mean  74.342105
         stdev 23.912424

Per-problem statistics, omitting zero grades:

Num  1:  mean  80.714286
         stdev 10.319389

[ search CSE | CSE home | bsy's home page | webster i/f | MRQE | google | yahoo | hotbot | lycos | altavista | pgp key svr | spam | commerce ]
picture of bsy

bsy+cse190.s00@cs.ucsd.edu, last updated Thu Jun 22 16:03:25 PDT 2000. Copyright 2000 Bennet Yee.
email bsy.

Don't make me hand over my privacy keys!