1. telnet to the time of day service

tucotuco.cs.indiana.edu% telnet school.cs.indiana.edu 13
Trying 129.79.252.119...
Connected to school.cs.indiana.edu.
Escape character is '^]'.
Thu Oct  1 12:08:51 1998
Connection closed by foreign host.
2. telnet to your web server

tucotuco.cs.indiana.edu% pwd
/nfs/paca/home/user2/dgerman/httpd/htdocs
tucotuco.cs.indiana.edu% vi myfile
tucotuco.cs.indiana.edu% cat myfile
 
    ***( this is my test )***

tucotuco.cs.indiana.edu% pwd
/nfs/paca/home/user2/dgerman/httpd/htdocs
tucotuco.cs.indiana.edu% 
[...]
school.cs.indiana.edu%telnet tucotuco.cs.indiana.edu 19800
Trying 129.79.251.110...
Connected to tucotuco.cs.indiana.edu.
Escape character is '^]'.
GET /myfile HTTP/1.0
 
HTTP/1.1 200 OK
Date: Thu, 01 Oct 1998 17:18:06 GMT
Server: Apache/1.3.1 (Unix)
Last-Modified: Thu, 01 Oct 1998 17:16:57 GMT
ETag: "4bccb-20-3613b909"
Accept-Ranges: bytes
Content-Length: 32
Connection: close
Content-Type: text/plain
 
 
    ***( this is my test )***
 
Connection closed by foreign host.
school.cs.indiana.edu%
2.1 write your own client

tucotuco.cs.indiana.edu% vi myClient.java
tucotuco.cs.indiana.edu% cat myClient.java
import java.io.*;
import java.net.*;
 
class myClient {
  public static void main (String[] args) {
    try {
      Socket t = new Socket("tucotuco.cs.indiana.edu", 13); 
      DataInputStream is = new DataInputStream(t.getInputStream()); 
      boolean more = true; 
      while (more) {
        String str = is.readLine(); 
        if (str == null) more = false; 
        else System.out.println(str); 
      } 
    } catch (IOException e) { 
      System.out.println("Error: " + e); 
    } 
  } 
} 
tucotuco.cs.indiana.edu% javac myClient.java
Note: myClient.java uses a deprecated API.  Recompile with "-deprecation" for details.
1 warning
tucotuco.cs.indiana.edu% java myClient
Thu Oct  1 12:20:33 1998
 

tucotuco.cs.indiana.edu% date
Thu Oct  1 12:20:37 EST 1998
tucotuco.cs.indiana.edu% date; java myClient; date
Thu Oct  1 12:20:50 EST 1998
Thu Oct  1 12:20:54 1998
 

Thu Oct  1 12:20:54 EST 1998
tucotuco.cs.indiana.edu% 

tucotuco.cs.indiana.edu% vi myNewClient.java
tucotuco.cs.indiana.edu% diff myClient.java myNewClient.java
4c4
< class myClient {
---
> class myNewClient {
7c7
<       Socket t = new Socket("tucotuco.cs.indiana.edu", 13);  
---
>       Socket t = new Socket("tucotuco.cs.indiana.edu", Integer.parseInt(args[0]));  
tucotuco.cs.indiana.edu% java myNewClient 13
Thu Oct  1 12:42:19 1998
 

tucotuco.cs.indiana.edu% 
2.2 write your own server

tucotuco.cs.indiana.edu% vi myServer.java
tucotuco.cs.indiana.edu% cat myServer.java
import java.io.*;
import java.net.*;
class myServer {
  public static void main (String[] args) {
    try {
      ServerSocket s = new ServerSocket(29800); 
      Socket incoming = s.accept(); 
      DataInputStream in = new DataInputStream(incoming.getInputStream()); 
      PrintStream out = new PrintStream(incoming.getOutputStream()); 
      out.println("Hello! Enter BYE to exit.\r"); 
      boolean done = false;
      while (! done) {
        String str = in.readLine(); 
        if (str == null) done = true; 
        else { 
          out.println("Echo: " + str + "\r"); 
          if (str.trim().equals("BYE")) done = true; 
        } 
      } 
      incoming.close(); 
    } catch (Exception e) {
      System.out.println(e); 
    } 
  } 
} 
tucotuco.cs.indiana.edu% javac myServer.java
Note: myServer.java uses a deprecated API.  Recompile with "-deprecation" for details.
1 warning
tucotuco.cs.indiana.edu% java myServer
 
... in the meantime on school... 

school.cs.indiana.edu%telnet tucotuco.cs.indiana.edu 29800
Trying 129.79.251.110...
Connected to tucotuco.cs.indiana.edu.
Escape character is '^]'.
Hello! Enter BYE to exit.
My name is Adrian
Echo: My name is Adrian
I see...
Echo: I see...
You too
Echo: You too
I mean you, not I.
Echo: I mean you, not I.
OK, BYE                
Echo: OK, BYE
BYE
Echo: BYE
Connection closed by foreign host.

3. POST to a script of yours with telnet

We have a script that can be used to mail a comment to the webmaster.

3.1 the script

tucotuco.cs.indiana.edu% pwd
/nfs/paca/home/user2/dgerman/httpd/cgi-bin/lecture9
tucotuco.cs.indiana.edu% ls -l *.pl
-rwx------   1 dgerman  students     265 Sep 27 23:49 mailto.pl
tucotuco.cs.indiana.edu% cat mailto.pl
#!/usr/bin/perl
 
print qq{Content-type: text/plain\n\n}; 
 
if ($ENV{'REQUEST_METHOD'} eq 'POST' && 
    open(MAIL, "| mail dgerman\@indiana.edu")) {
  while (<STDIN>) {
    print MAIL; 
  } 
  close(MAIL);      
  print "Mailto.pl";
} else {
  print "Error";   
} 
tucotuco.cs.indiana.edu%
3.2 the experiment

From school:

school.cs.indiana.edu%telnet tucotuco.cs.indiana.edu 19800
Trying 129.79.251.110...
Connected to tucotuco.cs.indiana.edu.
Escape character is '^]'.
POST /cgi-bin/lecture9/mailto.pl HTTP/1.0
Content-type: application/octet-stream
Content-length: 10
 
Greetings!
HTTP/1.1 200 OK
Date: Thu, 01 Oct 1998 18:03:22 GMT
Server: Apache/1.3.1 (Unix)
Connection: close
Content-Type: text/plain
 
Mailto.plConnection closed by foreign host.
school.cs.indiana.edu%

4. the feedback applet

It's a combination of three things: