Commit 4337c33b authored by Kevin's avatar Kevin
Browse files

add join endpoint

parent 5ae58e25
......@@ -17,7 +17,7 @@ import org.json.simple.parser.ParseException;
* @author Kevin Zhong Local
*/
public class EndpointMethod {
public String inventory(String username) throws IOException, ParseException {
public static String inventory(String username) throws IOException, ParseException {
JSONObject resultJson = new JSONObject();
JSONArray inventory_list = new JSONArray();
JSONParser parser = new JSONParser();
......@@ -48,7 +48,7 @@ public class EndpointMethod {
return resultJson.toString();
}
public String mixItem(String username, String item1, String item2) {
public static String mixItem(String username, String item1, String item2) {
JSONObject resultJson = new JSONObject();
JSONParser parser = new JSONParser();
try {
......@@ -190,6 +190,7 @@ public class EndpointMethod {
return resultJson.toString();
}
public static void main(String argv[]) throws IOException, ParseException {
// EndpointMethod tes = new EndpointMethod();
// System.out.println(tes.inventory("Kevi"));
......
......@@ -10,12 +10,24 @@
*/
import java.io.*;
import java.net.*;
import java.util.UUID;
import org.json.simple.JSONObject;
import org.json.simple.parser.JSONParser;
class TCPServer {
public static void join() throws IOException {
String sentence;
String modifiedSentence;
BufferedReader inFromUser = new BufferedReader(new InputStreamReader(System.in));
Socket newServer = new Socket("167.205.32.46", 8000);
DataOutputStream outToServer = new DataOutputStream(newServer.getOutputStream());
BufferedReader inFromServer = new BufferedReader(new InputStreamReader(newServer.getInputStream()));
sentence = inFromUser.readLine();
outToServer.write(sentence.getBytes());
modifiedSentence = inFromServer.readLine();
System.out.println("FROM SERVER: " + modifiedSentence);
newServer.close();
}
public static void main(String argv[]) throws Exception {
// ConnectionHandler CH = new ConnectionHandler();
// CH.start();
......
......@@ -121,7 +121,7 @@ public class crudDB {
}
public static void main(String argv[]) throws Exception {
crudDB tes=new crudDB();
// crudDB tes=new crudDB();
// System.out.println(tes.signUp("Kevin", "123"));
// System.out.println(tes.login("Kevin", "123"));
}
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment