1 / 22

Interpersonal Communications

Interpersonal Communications. My experience on campus Dr Knutson driving Experiment?

kiaria
Download Presentation

Interpersonal Communications

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Interpersonal Communications • My experience on campus • Dr Knutson driving • Experiment? • “There is another responsibility correlated and even coexistent with … agency, which is too infrequently emphasized, and that is the effect not only of a person’s actions, but also of his thoughts. Man radiates what he is, and that radiation affects to a greater or lesser degree every person who comes within that radiation” David O. McKay (“Free Agency … The Gift Divine,” Improvement Era, Feb 1962, 87) • “Thoughts mold your features. Thoughts lift your soul hevenward or drag you toward hell … As nothing reveals character like the company we like and keep, so nothing foretells futurity like the thoughts over which we brood … To have the approval of your conscience when you are alone with your thoughts is like being in the company of true and loving friends. To merit your own self-respect gives strength to character. Conscience is the link that binds your soul to the spirit of God” David O. McKay (“Those Sculptors Called Thoughts and Ideals, “ Improvement Era, July 1960, 495).

  2. Applications

  3. Daemons • Program that listens on a particular port and accepts connections for a protocol • Each protocol listens on a different port • A server is then created to interact with the client Client Server daemon

  4. Example Application: Remote Login w/ TELNET • Provides interactive access to computer from a remote site • Text-oriented interface • User • invokes client • specifies remote computer • Client • forms TCP connection to server • passes keystrokes over connection • displays output on screen • Defined in RFC 854

  5. Example Application: File Transfer Protocol (FTP) • Complete file copy • Uses TCP • Supports binary or text file transfers • Large set of commands • Until 1995, it was the major source of packets on the Internet • Defined in RFC 959

  6. FTP Illustrated

  7. Example Application: World Wide Web (WWW) • Web pages • can contain text, images, imbedded objects and links • standard authoring format is HTML • links use URL tags • transferred using HTTP • See http://www.w3c.org for all the details

  8. HyperText Markup Language • Document is free-format • Embedded tags give display format • Tags (often appear in pairs) • Paragraph <P> and </P> • Line break <BR> • Headings <H1>, <H2> • <IMG src=“jtk.jpg” border=“0”> • <A href=“http://www.depaul.edu”>DePaul</A>

  9. Uniform Resource Locator (URL) • Symbolic representation • Embedded in HTML document • Browser • hides text of link from user • associates link with item on page • makes items selectable

  10. URLs Illustrated (http :// www.byu.edu /index.html)

  11. HyperText Transfer Protocol (HTTP) • Web server makes web pages available • Server uses port 80 by default • Web client (browser) requests pages • Creates a TCP connection to server • HTTP sits on top of TCP • HTTP v1.1 defined in RFC 2068 • major enhancement over v1.0: single TCP connection for multiple HTTP requests

  12. HTTP Lab • Write a HTTP Daemon (web server) • Connect with netscape to your server • Retreive gif, txt, html files • Run CGI scripts

  13. HTTP Protocol • Web browser receives a url • http://hostname:port/pathname • Web browser connects to hostname and sends pathname in a HTTP request over to socket • GET /pathname HTTP/1.0 • Web server responds with contents of file or error page

  14. Example telnet students.cs.byu.edu 80 GET /foo.html HTTP/0.9 404 Server: Apache/1.3.3 Ben-SSL/1.29 (Unix) PHP/3.0.7 Content-type: text/html <HEAD><TITLE>404</TITLE></HEAD> <BODY bgcolor=FFFFFF><H1><img alt="" src=/images/icon.gif>404</H1> The requested URL:<code>/foo.html</code> was not found on this server. …

  15. Response HTTP/1.0 200 OK Attribute: value Attribute: value Attribute: value... file data ... TIP: use \r\n on the end of every line. Different browsers are picky about this and there are no real error messages if the browser doesn’t like your format write(sock, "HTTP/1.0 200 OK\r\n", strlen ("HTTP/1.0 200 OK\r\n"));

  16. Details • Status • 200 OK means that the request was completed successfully • 404 is an error that will usually be followed by html describing the problem • The attributes tell the browser how to display the content • Content-Type:<CONTENT TYPE><CRLF> • Text: text/plain • Html: text/html • GIF: image/gif • JPEG: image/jpeg • Content-Length:<file-length in bytes><CRLF> • Some browsers ignore this and figure it out on their own.

  17. Example http://tape.cs.byu.edu:1234/bungo.html The browser opens a socket connection to tape on port 1234. Your code should be listening on this port. The browser will then send the following request to your code. GET /bungo.html Followed by a bunch of information about the version and capabilities of the browser (this is how Amazon.com can charge you different prices depending on where you connect from). You should then respond with the contents of the file bungo.html if you can find the file

  18. Details • If the file exists, send it immediately after the Content-type attribute • If it doesn’t exist, send html with an error message and the 404 status • If it is a directory • If there is a index.html file, send it • Otherwise, send a listing of the directory • system(“ls pathname > file”); then send file • fd=popen (“ls pathname”); then read from fd

  19. CGI http://cheese.cs.byu.edu:1236/test6.cgi?teststring Is converted to GET <path>/<cgi-script>?query=<query text>+<param>|+<param>|+... GET /test6.cgi?query=teststring Your server should put the query string into an environment variable called QUERY_STRING, set up the environment variables REQUEST_METHOD and SERVER_PORT Execute the command (perl script) Capture the output and send it back on the socket

  20. Code Sample main(){char *cmd = "/usr/bin/ls *.c";char buf[BUFSIZ];FILE *ptr;if ((ptr = popen(cmd, "r")) != NULL) while (fgets(buf, BUFSIZ, ptr) != NULL) (void) printf("%s", buf); return 0;}

  21. Environment Variables /*Create the environmental variables*/sprintf(query_dest,"QUERY_STRING=%s",query);sprintf(content,"CONTENT_LENGTH=%s",length);sprintf(shell_cmd,"%s > %s",filename,handle);putenv("REQUEST_METHOD=GET");putenv(content);putenv(query_dest);

  22. Passoff

More Related