Received: from PACIFIC-CARRIER-ANNEX.MIT.EDU by po7.MIT.EDU (5.61/4.7) id AA24797; Fri, 1 Dec 95 15:03:35 EST
Received: from liquor.cabi.net by MIT.EDU with SMTP
	id AA23842; Fri, 1 Dec 95 15:02:22 EST
Received: (from listadm@localhost) by liquor.cabi.net (8.6.12/8.6.12) id OAA08228; Fri, 1 Dec 1995 14:24:27 -0500
Resent-Date: Fri, 1 Dec 1995 14:24:27 -0500
Date: Fri, 1 Dec 95 11:35:19 PST
From: ken_simpson@tmai.com (Kenneth Simpson)
Message-Id: <9512011935.AA27752@mailserver.tmai.com>
Subject: Re: Datagram Test Code, etc.
To: java-linux@java.blackdown.org
Reply-To: Ken_Simpson@tmai.com
Resent-Message-Id: <"VtLaB.0.e_1.GNrlm"@liquor>
Resent-From: java-linux@java.blackdown.org
X-Mailing-List: <java-linux@java.blackdown.org> archive/latest/592
X-Loop: java-linux@java.blackdown.org
Precedence: list
Resent-Sender: java-linux-request@java.blackdown.org

>>The datagram test code I originally posted courtesy of Sun's
>>engineers, and which recently appeared on this mailing list,
>>is definitely for UDP Internet datagrams. Note the need for
>>a host and port to send the datagrams to and so forth. It 
>>has nothing to do with Unix domain sockets.
>>

Hmm - isn't a socket a combination of an IP address and a port? So if 
the socket is broken, then and it doesn't matter if the packet is sent with 
UDP or TCP - one would expect the service to be broken too? 

It's a "Unix domain socket" a socket?

-- Ken 


class DatagramClient {
    public static void main(String argv[]) {
	if (argv.length!=2) {
	     System.out.println("java DatagramClient <hostname> <port#>");
	     return;
	}
	try {
	    int port = Integer.parseInt(argv[1]);
	    InetAddress in = InetAddress.getByName(argv[0]);
	    // InetTuple tup = new InetTuple(in, atoi(argv[1]);
	    DatagramSocket s = new DatagramSocket();
	    byte buf[] = new byte[10];
	    for (int i=0; i<buf.length; ++i) buf[i] = (byte)i;
	    DatagramPacket dp = new DatagramPacket(buf, 10, in, port);
	    s.send(dp);
	    s.close();
	} catch (Exception e) {
		System.out.println("Something bad happened.");
	}
    }
}


-- Ken 

=========================================================================
Kenneth Simpson                     Technology Modeling Associates, Inc. 
Internet: Ken_Simpson@TMAI.com      3950 Fabian Way
AT&T: +1.415.812.7233               Palo Alto, CA 94303                       
FAX:  +1.415.856.8860               USA, Earth                          
=========================================================================


