-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathGetTeamResponse.java
38 lines (35 loc) · 951 Bytes
/
GetTeamResponse.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
/**
* CPSC 559 Winter 2021 Project Component ITERATION 1
*
* FILE: getTeamResponse.java
* getTeamResponse() Function
* Response for 'get team name' response. Returns the team name back to the registry
*
* @author Jason Huang
* @UCID 10149037
*
*/
package registry;
import java.io.BufferedWriter;
import java.io.IOException;
import java.io.OutputStreamWriter;
import java.net.Socket;
public class GetTeamResponse {
Socket sock;
String teamName;
BufferedWriter writer;
public GetTeamResponse(Socket sock, BufferedWriter writer, String teamName) {
this.sock = sock;
this.writer = writer;
this.teamName = teamName;
}
public void sendResponse() throws IOException {
writer = new BufferedWriter(new OutputStreamWriter(sock.getOutputStream()));
String message = "";
//<team name response> ::= <team name><newline>
message = message + teamName;
message = message + "\n";
writer.write(message);
writer.flush();
}
}