Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package geogre.qupty;
- import java.net.Socket;
- import java.time.LocalDateTime;
- import java.time.LocalTime;
- import java.util.Vector;
- /**
- * Created by GEORGE on 11/6/2015.
- */
- public class Common {
- /* Debug */
- public static boolean bDebug = true;
- public static void Debug(String _message)
- {
- if(bDebug)
- System.out.println(LocalTime.now() + " : " + _message);
- }
- /* Connection */
- public static final int nServerPort = 55620;
- public static final int nRealTimePort = 54456;
- public static final String sMySQL_User = "root";
- public static final String sMySQL_Password = "4a5awhat";
- public static final String sMySQL_ConnectionURL = "jdbc:mysql://127.0.0.1:9999/test";
- /* Packet ID */
- public static final int nLogin = 1;
- public static final int nUpdateProfile = 2;
- public static final int nConversationList = 3;
- public static final int nConversationPrivate = 4;
- public static final int nConversationPrivateList= 5;
- public static final int nConversationGroup = 6;
- public static final int nConversationServer = 7;
- public static final int nDisconnect = 10;
- /* RealTime */
- public static Vector<Socket> ClientSockets = new Vector<Socket>();
- public static Vector <String>LoginNames = new Vector<String>();
- public static Socket RouteToListener(String _string) {
- Common.Debug("RouteToListener ");
- for (int iCount = 0; iCount < LoginNames.size(); iCount++) {
- if (LoginNames.elementAt(iCount).equals(_string)) {
- return ClientSockets.elementAt(iCount);
- }
- }
- return null;
- }
- public static void Disconnect(Socket _socket) {
- for (int iCount = 0; iCount < ClientSockets.size(); iCount++) {
- if (ClientSockets.elementAt(iCount).equals(_socket)) {
- LoginNames.removeElementAt(iCount);
- ClientSockets.removeElementAt(iCount);
- Common.Debug("Disconnect ");
- break;
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement