java.util.List<Double> getHistory(String comp, int count) { int cmdID = commID++; // connect(user.getName(),user.getPassword()); try { out.println(cmdID + ";" + "getch:" + comp + ":" + Integer.toString(count)); out.flush(); return (java.util.List<Double>) receiveReply(cmdID); } catch (Exception r) { r.printStackTrace(); } return null; }
String getChatHistory(String user, String pass) { int cmdID = commID++; connect(user, pass); try { out.println(cmdID + ";chath"); out.flush(); return (String) receiveReply(cmdID); } catch (Exception r) { r.printStackTrace(); } return null; }
String cancelShares(String user, String pass, int id, int sellid) { int cmdID = commID++; connect(user, pass); try { out.println(cmdID + ";cancel:" + id + ":" + sellid); out.flush(); return (String) receiveReply(cmdID); } catch (Exception r) { r.printStackTrace(); } return null; }
String sendChat(String s, String user, String pass) { int cmdID = commID++; connect(user, pass); try { out.println(cmdID + ";chat:" + s.trim()); out.flush(); return (String) receiveReply(cmdID); } catch (Exception r) { r.printStackTrace(); } return null; }
void placeOrder(final User user, String cmd, Company comp, int qty, int id) { int cmdID = commID++; connect(user.getName(), user.getPassword()); try { out.println(cmdID + ";" + cmd + ":" + comp.name + ":" + Integer.toString(qty) + ":" + id); out.flush(); Shares pen = (Shares) receiveReply(cmdID); user.getPendingShares().add(pen); user.dataChanged(); } catch (Exception r) { r.printStackTrace(); } }
public void disconnect() { int cmdID = commID++; this.connected = false; try { out.println(cmdID + ";logout"); out.flush(); in.close(); out.close(); socket.close(); } catch (IOException ex) { System.err.println("Server stop failed."); } }
String login(String domain, String user, String pass) { int cmdID = commID++; this.domain = domain; connect(user, pass); try { out.println(cmdID + ";login:"******":" + pass); out.flush(); String rep = (String) receiveReply(cmdID); return rep.split(":")[0]; } catch (Exception r) { r.printStackTrace(); } return null; }
User getUserDetails(String user, String pass) { int cmdID = commID++; connect(user, pass); try { usrD = 1; out.println(cmdID + ";gud"); out.flush(); User vv = (User) receiveReply(cmdID); usrD = 0; return vv; } catch (Exception r) { r.printStackTrace(); } return null; }