-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathGoodbye.java
64 lines (53 loc) · 1.44 KB
/
Goodbye.java
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
import java.io.*;
import java.net.*;
public class Goodbye extends HelloGoodbye
{
/*
Amber Krause
December 5, 2016
CISC 230-02
Doctor Jarvis
This class sends out Goodbye messages.
Class variables:
serialVersionUID
a serialVersionUID used for serialization.
Constructors:
Goodbye(String userName, InetAddress multicastGroup, int multicastPort)
creates a new Goodbye object set to the values of the parameters.
Methods:
run()
sends a serialized version of this object.
Modification History:
December 5, 2016
original version.
*/
private static final long serialVersionUID = 1;
public Goodbye(String userName, InetAddress multicastGroup, int multicastPort) throws IOException
{
super(userName, multicastGroup, multicastPort);
} //constructor
public void run()
{
//send a serialized version of this object
byte[] buffer;
ByteArrayOutputStream byteArrayOutputStream;
ObjectOutputStream objectOutputStream;
DatagramPacket packet;
try { this.sendMe(); }
catch(Exception e) { throw new RuntimeException(e.getMessage()); }
} //run
/*
public static void main(String[] args) throws IOException
{
//run a Goodbye object
Goodbye goodbye;
goodbye = new Goodbye("AmberKrause", InetAddress.getByName("228.5.6.7"), 8888);
for(int i = 0; i < 3; i++)
{
new Thread(goodbye).start();
try { Thread.sleep(1000); }
catch(InterruptedException ie) {}
} //for
} //main
*/
} //class Goodbye