Browse Source

Release 25

master
Defend 8 years ago
parent
commit
51b1807aa6
  1. 301
      .idea/workspace.xml
  2. 95
      src/client.java
  3. 178
      src/console.java
  4. 5
      src/ctServer.java
  5. 153
      src/eventHandler.java
  6. 45
      src/socketInfo.java

301
.idea/workspace.xml

@ -28,8 +28,8 @@
<file leaf-file-name="ctServer.java" pinned="false" current-in-tab="false"> <file leaf-file-name="ctServer.java" pinned="false" current-in-tab="false">
<entry file="file://$PROJECT_DIR$/src/ctServer.java"> <entry file="file://$PROJECT_DIR$/src/ctServer.java">
<provider selected="true" editor-type-id="text-editor"> <provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="255"> <state relative-caret-position="102">
<caret line="15" column="16" selection-start-line="15" selection-start-column="16" selection-end-line="15" selection-end-column="16" /> <caret line="6" column="26" selection-start-line="6" selection-start-column="26" selection-end-line="6" selection-end-column="26" />
<folding> <folding>
<element signature="imports" expanded="true" /> <element signature="imports" expanded="true" />
</folding> </folding>
@ -37,18 +37,22 @@
</provider> </provider>
</entry> </entry>
</file> </file>
<file leaf-file-name="console.java" pinned="false" current-in-tab="false"> <file leaf-file-name="console.java" pinned="false" current-in-tab="true">
<entry file="file://$PROJECT_DIR$/src/console.java"> <entry file="file://$PROJECT_DIR$/src/console.java">
<provider selected="true" editor-type-id="text-editor"> <provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="187"> <state relative-caret-position="17">
<caret line="11" column="4" selection-start-line="11" selection-start-column="4" selection-end-line="11" selection-end-column="4" /> <caret line="3" column="23" selection-start-line="3" selection-start-column="23" selection-end-line="3" selection-end-column="23" />
<folding> <folding>
<element signature="imports" expanded="true" />
<element signature="method#consoleListner#0;class#console#0" expanded="false" /> <element signature="method#consoleListner#0;class#console#0" expanded="false" />
<element signature="method#out#0;class#console#0" expanded="false" /> <element signature="method#out#0;class#console#0" expanded="false" />
<element signature="method#socket#0;class#console#0" expanded="false" /> <element signature="method#socket#0;class#console#0" expanded="false" />
<element signature="method#debug#0;class#console#0" expanded="false" /> <element signature="method#debug#0;class#console#0" expanded="false" />
<element signature="method#run#0;class#console#0" expanded="false" /> <element signature="method#cList#0;class#console#0" expanded="false" />
<element signature="method#cKick#0;class#console#0" expanded="false" />
<element signature="method#cSend#0;class#console#0" expanded="false" />
<element signature="method#cHelp#0;class#console#0" expanded="false" />
<element signature="method#cInfo#0;class#console#0" expanded="false" />
<element signature="method#cRestart#0;class#console#0" expanded="false" />
</folding> </folding>
</state> </state>
</provider> </provider>
@ -57,31 +61,37 @@
<file leaf-file-name="socketInfo.java" pinned="false" current-in-tab="false"> <file leaf-file-name="socketInfo.java" pinned="false" current-in-tab="false">
<entry file="file://$PROJECT_DIR$/src/socketInfo.java"> <entry file="file://$PROJECT_DIR$/src/socketInfo.java">
<provider selected="true" editor-type-id="text-editor"> <provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="-804"> <state relative-caret-position="530">
<caret line="72" column="53" selection-start-line="72" selection-start-column="34" selection-end-line="72" selection-end-column="53" /> <caret line="182" column="24" selection-start-line="182" selection-start-column="24" selection-end-line="182" selection-end-column="24" />
<folding /> <folding>
<element signature="imports" expanded="true" />
</folding>
</state> </state>
</provider> </provider>
</entry> </entry>
</file> </file>
<file leaf-file-name="eventHandler.java" pinned="false" current-in-tab="false"> <file leaf-file-name="client.java" pinned="false" current-in-tab="false">
<entry file="file://$PROJECT_DIR$/src/eventHandler.java"> <entry file="file://$PROJECT_DIR$/src/client.java">
<provider selected="true" editor-type-id="text-editor"> <provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="68"> <state relative-caret-position="340">
<caret line="4" column="0" selection-start-line="4" selection-start-column="0" selection-end-line="4" selection-end-column="0" /> <caret line="279" column="69" selection-start-line="279" selection-start-column="69" selection-end-line="279" selection-end-column="69" />
<folding /> <folding>
<element signature="imports" expanded="true" />
<element signature="method#bytesToStringUTFCustom#0;class#client#0" expanded="false" />
<element signature="method#handshake#0;class#client#0" expanded="false" />
</folding>
</state> </state>
</provider> </provider>
</entry> </entry>
</file> </file>
<file leaf-file-name="client.java" pinned="false" current-in-tab="true"> <file leaf-file-name="eventHandler.java" pinned="false" current-in-tab="false">
<entry file="file://$PROJECT_DIR$/src/client.java"> <entry file="file://$PROJECT_DIR$/src/eventHandler.java">
<provider selected="true" editor-type-id="text-editor"> <provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="-5"> <state relative-caret-position="530">
<caret line="98" column="33" selection-start-line="98" selection-start-column="33" selection-end-line="98" selection-end-column="33" /> <caret line="152" column="36" selection-start-line="152" selection-start-column="36" selection-end-line="152" selection-end-column="36" />
<folding> <folding>
<element signature="imports" expanded="true" /> <element signature="imports" expanded="true" />
<element signature="method#bytesToStringUTFCustom#0;class#client#0" expanded="false" /> <element signature="method#close#0;class#eventHandler#0" expanded="false" />
</folding> </folding>
</state> </state>
</provider> </provider>
@ -108,10 +118,10 @@
<option value="$PROJECT_DIR$/src/main.java" /> <option value="$PROJECT_DIR$/src/main.java" />
<option value="$PROJECT_DIR$/lib/javax.json.jar!/javax/json/stream/JsonParser.class" /> <option value="$PROJECT_DIR$/lib/javax.json.jar!/javax/json/stream/JsonParser.class" />
<option value="$PROJECT_DIR$/src/socketInfo.java" /> <option value="$PROJECT_DIR$/src/socketInfo.java" />
<option value="$PROJECT_DIR$/src/console.java" />
<option value="$PROJECT_DIR$/src/ctServer.java" />
<option value="$PROJECT_DIR$/src/eventHandler.java" />
<option value="$PROJECT_DIR$/src/client.java" /> <option value="$PROJECT_DIR$/src/client.java" />
<option value="$PROJECT_DIR$/src/eventHandler.java" />
<option value="$PROJECT_DIR$/src/ctServer.java" />
<option value="$PROJECT_DIR$/src/console.java" />
</list> </list>
</option> </option>
</component> </component>
@ -152,6 +162,7 @@
<foldersAlwaysOnTop value="true" /> <foldersAlwaysOnTop value="true" />
</navigator> </navigator>
<panes> <panes>
<pane id="PackagesPane" />
<pane id="Scratches" /> <pane id="Scratches" />
<pane id="Scope" /> <pane id="Scope" />
<pane id="ProjectPane"> <pane id="ProjectPane">
@ -186,6 +197,24 @@
<option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.PsiDirectoryNode" /> <option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.PsiDirectoryNode" />
</PATH_ELEMENT> </PATH_ELEMENT>
</PATH> </PATH>
<PATH>
<PATH_ELEMENT>
<option name="myItemId" value="ctServer" />
<option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.ProjectViewProjectNode" />
</PATH_ELEMENT>
<PATH_ELEMENT>
<option name="myItemId" value="ctServer" />
<option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.PsiDirectoryNode" />
</PATH_ELEMENT>
<PATH_ELEMENT>
<option name="myItemId" value="lib" />
<option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.PsiDirectoryNode" />
</PATH_ELEMENT>
<PATH_ELEMENT>
<option name="myItemId" value="javax.json.jar" />
<option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.PsiFileNode" />
</PATH_ELEMENT>
</PATH>
<PATH> <PATH>
<PATH_ELEMENT> <PATH_ELEMENT>
<option name="myItemId" value="ctServer" /> <option name="myItemId" value="ctServer" />
@ -202,7 +231,6 @@
</PATH> </PATH>
</subPane> </subPane>
</pane> </pane>
<pane id="PackagesPane" />
</panes> </panes>
</component> </component>
<component name="PropertiesComponent"> <component name="PropertiesComponent">
@ -215,6 +243,7 @@
<property name="GenerateAntBuildDialog.backupFiles" value="true" /> <property name="GenerateAntBuildDialog.backupFiles" value="true" />
<property name="GenerateAntBuildDialog.outputFileNameProperty" value="ctserver" /> <property name="GenerateAntBuildDialog.outputFileNameProperty" value="ctserver" />
<property name="last_opened_file_path" value="$PROJECT_DIR$" /> <property name="last_opened_file_path" value="$PROJECT_DIR$" />
<property name="extract.method.default.visibility" value="private" />
<property name="restartRequiresConfirmation" value="false" /> <property name="restartRequiresConfirmation" value="false" />
</component> </component>
<component name="RunManager" selected="Application.Debug"> <component name="RunManager" selected="Application.Debug">
@ -698,12 +727,13 @@
<workItem from="1470992276279" duration="9337000" /> <workItem from="1470992276279" duration="9337000" />
<workItem from="1471206887598" duration="5117000" /> <workItem from="1471206887598" duration="5117000" />
<workItem from="1471213151749" duration="371000" /> <workItem from="1471213151749" duration="371000" />
<workItem from="1471272205780" duration="10014000" /> <workItem from="1471272205780" duration="2459000" />
<workItem from="1471346121020" duration="38313000" />
</task> </task>
<servers /> <servers />
</component> </component>
<component name="TimeTrackingManager"> <component name="TimeTrackingManager">
<option name="totallyTimeSpent" value="102627000" /> <option name="totallyTimeSpent" value="133385000" />
</component> </component>
<component name="TodoView"> <component name="TodoView">
<todo-panel id="selected-file"> <todo-panel id="selected-file">
@ -720,30 +750,30 @@
<layout> <layout>
<window_info id="Palette" active="false" anchor="right" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.33" sideWeight="0.5" order="3" side_tool="false" content_ui="tabs" /> <window_info id="Palette" active="false" anchor="right" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.33" sideWeight="0.5" order="3" side_tool="false" content_ui="tabs" />
<window_info id="TODO" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.3290461" sideWeight="0.5" order="6" side_tool="false" content_ui="tabs" /> <window_info id="TODO" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.3290461" sideWeight="0.5" order="6" side_tool="false" content_ui="tabs" />
<window_info id="Messages" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.3279743" sideWeight="0.4792111" order="7" side_tool="false" content_ui="tabs" /> <window_info id="Messages" active="true" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="true" show_stripe_button="true" weight="0.32690248" sideWeight="0.4792111" order="7" side_tool="false" content_ui="tabs" />
<window_info id="Palette&#9;" active="false" anchor="left" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.33" sideWeight="0.5" order="2" side_tool="false" content_ui="tabs" /> <window_info id="Palette&#9;" active="false" anchor="left" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.33" sideWeight="0.5" order="2" side_tool="false" content_ui="tabs" />
<window_info id="Capture Analysis" active="false" anchor="right" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.33" sideWeight="0.5" order="3" side_tool="false" content_ui="tabs" /> <window_info id="Capture Analysis" active="false" anchor="right" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.33" sideWeight="0.5" order="3" side_tool="false" content_ui="tabs" />
<window_info id="Event Log" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.3876853" sideWeight="0.5444984" order="7" side_tool="true" content_ui="tabs" /> <window_info id="Event Log" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.3869239" sideWeight="0.5042644" order="8" side_tool="true" content_ui="tabs" />
<window_info id="Maven Projects" active="false" anchor="right" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.33" sideWeight="0.5" order="3" side_tool="false" content_ui="tabs" /> <window_info id="Maven Projects" active="false" anchor="right" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.33" sideWeight="0.5" order="3" side_tool="false" content_ui="tabs" />
<window_info id="Version Control" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.33" sideWeight="0.5" order="7" side_tool="false" content_ui="tabs" /> <window_info id="Version Control" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.33" sideWeight="0.5" order="9" side_tool="false" content_ui="tabs" />
<window_info id="Run" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.3858521" sideWeight="0.45550162" order="2" side_tool="false" content_ui="tabs" /> <window_info id="Run" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.17363344" sideWeight="0.45550162" order="5" side_tool="false" content_ui="tabs" />
<window_info id="Terminal" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.32839224" sideWeight="0.4978678" order="7" side_tool="false" content_ui="tabs" /> <window_info id="Terminal" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.3279743" sideWeight="0.49573562" order="10" side_tool="false" content_ui="tabs" />
<window_info id="Capture Tool" active="false" anchor="left" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.33" sideWeight="0.5" order="2" side_tool="false" content_ui="tabs" /> <window_info id="Capture Tool" active="false" anchor="left" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.33" sideWeight="0.5" order="2" side_tool="false" content_ui="tabs" />
<window_info id="Designer" active="false" anchor="right" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.33" sideWeight="0.5" order="3" side_tool="false" content_ui="tabs" /> <window_info id="Designer" active="false" anchor="right" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.33" sideWeight="0.5" order="3" side_tool="false" content_ui="tabs" />
<window_info id="Project" active="false" anchor="left" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="true" show_stripe_button="true" weight="0.0858209" sideWeight="0.5" order="0" side_tool="false" content_ui="combo" /> <window_info id="Project" active="false" anchor="left" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="true" show_stripe_button="true" weight="0.08315565" sideWeight="0.5" order="0" side_tool="false" content_ui="combo" />
<window_info id="Database" active="false" anchor="right" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.33" sideWeight="0.5" order="3" side_tool="false" content_ui="tabs" /> <window_info id="Database" active="false" anchor="right" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.33" sideWeight="0.5" order="3" side_tool="false" content_ui="tabs" />
<window_info id="Find" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.3290461" sideWeight="0.5" order="1" side_tool="false" content_ui="tabs" />
<window_info id="Structure" active="false" anchor="left" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.25" sideWeight="0.5" order="1" side_tool="false" content_ui="tabs" /> <window_info id="Structure" active="false" anchor="left" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.25" sideWeight="0.5" order="1" side_tool="false" content_ui="tabs" />
<window_info id="Ant Build" active="false" anchor="right" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.25" sideWeight="0.5" order="1" side_tool="false" content_ui="tabs" /> <window_info id="Ant Build" active="false" anchor="right" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.25" sideWeight="0.5" order="1" side_tool="false" content_ui="tabs" />
<window_info id="UI Designer" active="false" anchor="left" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.33" sideWeight="0.5" order="2" side_tool="false" content_ui="tabs" /> <window_info id="UI Designer" active="false" anchor="left" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.33" sideWeight="0.5" order="2" side_tool="false" content_ui="tabs" />
<window_info id="Debug" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.39871383" sideWeight="0.47708333" order="3" side_tool="false" content_ui="tabs" /> <window_info id="Debug" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.39935064" sideWeight="0.47708333" order="2" side_tool="false" content_ui="tabs" />
<window_info id="Favorites" active="false" anchor="left" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.33" sideWeight="0.5" order="2" side_tool="true" content_ui="tabs" /> <window_info id="Favorites" active="false" anchor="left" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.33" sideWeight="0.5" order="2" side_tool="true" content_ui="tabs" />
<window_info id="Cvs" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.25" sideWeight="0.5" order="4" side_tool="false" content_ui="tabs" /> <window_info id="Cvs" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.25" sideWeight="0.5" order="3" side_tool="false" content_ui="tabs" />
<window_info id="Message" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.33" sideWeight="0.5" order="0" side_tool="false" content_ui="tabs" /> <window_info id="Message" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.33" sideWeight="0.5" order="0" side_tool="false" content_ui="tabs" />
<window_info id="Commander" active="false" anchor="right" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.4" sideWeight="0.5" order="0" side_tool="false" content_ui="tabs" /> <window_info id="Commander" active="false" anchor="right" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.4" sideWeight="0.5" order="0" side_tool="false" content_ui="tabs" />
<window_info id="Hierarchy" active="false" anchor="right" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.25" sideWeight="0.5" order="2" side_tool="false" content_ui="combo" /> <window_info id="Hierarchy" active="false" anchor="right" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.25" sideWeight="0.5" order="2" side_tool="false" content_ui="combo" />
<window_info id="Inspection" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.4" sideWeight="0.5" order="5" side_tool="false" content_ui="tabs" /> <window_info id="Inspection" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.4" sideWeight="0.5" order="4" side_tool="false" content_ui="tabs" />
<window_info id="Coverage" active="false" anchor="right" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.32942432" sideWeight="0.5" order="3" side_tool="true" content_ui="tabs" /> <window_info id="Coverage" active="false" anchor="right" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.32942432" sideWeight="0.5" order="3" side_tool="true" content_ui="tabs" />
<window_info id="Find" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.3290461" sideWeight="0.5" order="1" side_tool="false" content_ui="tabs" />
</layout> </layout>
</component> </component>
<component name="Vcs.Log.UiProperties"> <component name="Vcs.Log.UiProperties">
@ -759,7 +789,15 @@
</component> </component>
<component name="XDebuggerManager"> <component name="XDebuggerManager">
<breakpoint-manager> <breakpoint-manager>
<option name="time" value="39" /> <breakpoints>
<line-breakpoint enabled="true" type="java-line">
<url>file://$PROJECT_DIR$/src/console.java</url>
<line>17</line>
<properties />
<option name="timeStamp" value="40" />
</line-breakpoint>
</breakpoints>
<option name="time" value="50" />
</breakpoint-manager> </breakpoint-manager>
<watches-manager /> <watches-manager />
</component> </component>
@ -768,6 +806,57 @@
<option name="FILTER_TARGETS" value="false" /> <option name="FILTER_TARGETS" value="false" />
</component> </component>
<component name="editorHistoryManager"> <component name="editorHistoryManager">
<entry file="file://$PROJECT_DIR$/src/ctServer.java">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="119">
<caret line="7" column="51" selection-start-line="7" selection-start-column="51" selection-end-line="7" selection-end-column="51" />
<folding>
<element signature="imports" expanded="true" />
</folding>
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/src/console.java">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="340">
<caret line="20" column="5" selection-start-line="20" selection-start-column="5" selection-end-line="20" selection-end-column="5" />
<folding>
<element signature="method#consoleListner#0;class#console#0" expanded="false" />
<element signature="method#out#0;class#console#0" expanded="false" />
<element signature="method#socket#0;class#console#0" expanded="false" />
<element signature="method#debug#0;class#console#0" expanded="false" />
<element signature="method#cList#0;class#console#0" expanded="false" />
<element signature="method#cKick#0;class#console#0" expanded="false" />
<element signature="method#cSend#0;class#console#0" expanded="false" />
<element signature="method#cHelp#0;class#console#0" expanded="false" />
<element signature="method#cInfo#0;class#console#0" expanded="false" />
<element signature="method#cRestart#0;class#console#0" expanded="false" />
</folding>
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/src/socketInfo.java">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="0">
<caret line="0" column="0" selection-start-line="0" selection-start-column="0" selection-end-line="0" selection-end-column="0" />
<folding>
<element signature="imports" expanded="true" />
</folding>
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/src/client.java">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="2720">
<caret line="160" column="15" selection-start-line="160" selection-start-column="15" selection-end-line="160" selection-end-column="15" />
<folding>
<element signature="imports" expanded="true" />
<element signature="method#bytesToStringUTFCustom#0;class#client#0" expanded="false" />
<element signature="method#handshake#0;class#client#0" expanded="false" />
</folding>
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/src/ctServer.java"> <entry file="file://$PROJECT_DIR$/src/ctServer.java">
<provider selected="true" editor-type-id="text-editor"> <provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="527"> <state relative-caret-position="527">
@ -783,12 +872,16 @@
<state relative-caret-position="1037"> <state relative-caret-position="1037">
<caret line="67" column="90" selection-start-line="67" selection-start-column="90" selection-end-line="67" selection-end-column="90" /> <caret line="67" column="90" selection-start-line="67" selection-start-column="90" selection-end-line="67" selection-end-column="90" />
<folding> <folding>
<element signature="imports" expanded="true" />
<element signature="method#consoleListner#0;class#console#0" expanded="false" /> <element signature="method#consoleListner#0;class#console#0" expanded="false" />
<element signature="method#out#0;class#console#0" expanded="false" /> <element signature="method#out#0;class#console#0" expanded="false" />
<element signature="method#socket#0;class#console#0" expanded="false" /> <element signature="method#socket#0;class#console#0" expanded="false" />
<element signature="method#debug#0;class#console#0" expanded="false" /> <element signature="method#debug#0;class#console#0" expanded="false" />
<element signature="method#run#0;class#console#0" expanded="false" /> <element signature="method#cList#0;class#console#0" expanded="false" />
<element signature="method#cKick#0;class#console#0" expanded="false" />
<element signature="method#cSend#0;class#console#0" expanded="false" />
<element signature="method#cHelp#0;class#console#0" expanded="false" />
<element signature="method#cInfo#0;class#console#0" expanded="false" />
<element signature="method#cRestart#0;class#console#0" expanded="false" />
</folding> </folding>
</state> </state>
</provider> </provider>
@ -797,7 +890,9 @@
<provider selected="true" editor-type-id="text-editor"> <provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="1496"> <state relative-caret-position="1496">
<caret line="89" column="37" selection-start-line="89" selection-start-column="37" selection-end-line="89" selection-end-column="37" /> <caret line="89" column="37" selection-start-line="89" selection-start-column="37" selection-end-line="89" selection-end-column="37" />
<folding /> <folding>
<element signature="imports" expanded="true" />
</folding>
</state> </state>
</provider> </provider>
</entry> </entry>
@ -808,6 +903,7 @@
<folding> <folding>
<element signature="imports" expanded="true" /> <element signature="imports" expanded="true" />
<element signature="method#bytesToStringUTFCustom#0;class#client#0" expanded="false" /> <element signature="method#bytesToStringUTFCustom#0;class#client#0" expanded="false" />
<element signature="method#handshake#0;class#client#0" expanded="false" />
</folding> </folding>
</state> </state>
</provider> </provider>
@ -835,12 +931,16 @@
<state relative-caret-position="1037"> <state relative-caret-position="1037">
<caret line="67" column="90" selection-start-line="67" selection-start-column="90" selection-end-line="67" selection-end-column="90" /> <caret line="67" column="90" selection-start-line="67" selection-start-column="90" selection-end-line="67" selection-end-column="90" />
<folding> <folding>
<element signature="imports" expanded="true" />
<element signature="method#consoleListner#0;class#console#0" expanded="false" /> <element signature="method#consoleListner#0;class#console#0" expanded="false" />
<element signature="method#out#0;class#console#0" expanded="false" /> <element signature="method#out#0;class#console#0" expanded="false" />
<element signature="method#socket#0;class#console#0" expanded="false" /> <element signature="method#socket#0;class#console#0" expanded="false" />
<element signature="method#debug#0;class#console#0" expanded="false" /> <element signature="method#debug#0;class#console#0" expanded="false" />
<element signature="method#run#0;class#console#0" expanded="false" /> <element signature="method#cList#0;class#console#0" expanded="false" />
<element signature="method#cKick#0;class#console#0" expanded="false" />
<element signature="method#cSend#0;class#console#0" expanded="false" />
<element signature="method#cHelp#0;class#console#0" expanded="false" />
<element signature="method#cInfo#0;class#console#0" expanded="false" />
<element signature="method#cRestart#0;class#console#0" expanded="false" />
</folding> </folding>
</state> </state>
</provider> </provider>
@ -849,7 +949,9 @@
<provider selected="true" editor-type-id="text-editor"> <provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="1496"> <state relative-caret-position="1496">
<caret line="89" column="37" selection-start-line="89" selection-start-column="37" selection-end-line="89" selection-end-column="37" /> <caret line="89" column="37" selection-start-line="89" selection-start-column="37" selection-end-line="89" selection-end-column="37" />
<folding /> <folding>
<element signature="imports" expanded="true" />
</folding>
</state> </state>
</provider> </provider>
</entry> </entry>
@ -860,6 +962,7 @@
<folding> <folding>
<element signature="imports" expanded="true" /> <element signature="imports" expanded="true" />
<element signature="method#bytesToStringUTFCustom#0;class#client#0" expanded="false" /> <element signature="method#bytesToStringUTFCustom#0;class#client#0" expanded="false" />
<element signature="method#handshake#0;class#client#0" expanded="false" />
</folding> </folding>
</state> </state>
</provider> </provider>
@ -887,12 +990,16 @@
<state relative-caret-position="0"> <state relative-caret-position="0">
<caret line="0" column="0" selection-start-line="0" selection-start-column="0" selection-end-line="0" selection-end-column="0" /> <caret line="0" column="0" selection-start-line="0" selection-start-column="0" selection-end-line="0" selection-end-column="0" />
<folding> <folding>
<element signature="imports" expanded="true" />
<element signature="method#consoleListner#0;class#console#0" expanded="false" /> <element signature="method#consoleListner#0;class#console#0" expanded="false" />
<element signature="method#out#0;class#console#0" expanded="false" /> <element signature="method#out#0;class#console#0" expanded="false" />
<element signature="method#socket#0;class#console#0" expanded="false" /> <element signature="method#socket#0;class#console#0" expanded="false" />
<element signature="method#debug#0;class#console#0" expanded="false" /> <element signature="method#debug#0;class#console#0" expanded="false" />
<element signature="method#run#0;class#console#0" expanded="false" /> <element signature="method#cList#0;class#console#0" expanded="false" />
<element signature="method#cKick#0;class#console#0" expanded="false" />
<element signature="method#cSend#0;class#console#0" expanded="false" />
<element signature="method#cHelp#0;class#console#0" expanded="false" />
<element signature="method#cInfo#0;class#console#0" expanded="false" />
<element signature="method#cRestart#0;class#console#0" expanded="false" />
</folding> </folding>
</state> </state>
</provider> </provider>
@ -904,6 +1011,7 @@
<folding> <folding>
<element signature="imports" expanded="true" /> <element signature="imports" expanded="true" />
<element signature="method#bytesToStringUTFCustom#0;class#client#0" expanded="false" /> <element signature="method#bytesToStringUTFCustom#0;class#client#0" expanded="false" />
<element signature="method#handshake#0;class#client#0" expanded="false" />
</folding> </folding>
</state> </state>
</provider> </provider>
@ -923,12 +1031,16 @@
<state relative-caret-position="1088"> <state relative-caret-position="1088">
<caret line="64" column="91" selection-start-line="64" selection-start-column="91" selection-end-line="64" selection-end-column="91" /> <caret line="64" column="91" selection-start-line="64" selection-start-column="91" selection-end-line="64" selection-end-column="91" />
<folding> <folding>
<element signature="imports" expanded="true" />
<element signature="method#consoleListner#0;class#console#0" expanded="false" /> <element signature="method#consoleListner#0;class#console#0" expanded="false" />
<element signature="method#out#0;class#console#0" expanded="false" /> <element signature="method#out#0;class#console#0" expanded="false" />
<element signature="method#socket#0;class#console#0" expanded="false" /> <element signature="method#socket#0;class#console#0" expanded="false" />
<element signature="method#debug#0;class#console#0" expanded="false" /> <element signature="method#debug#0;class#console#0" expanded="false" />
<element signature="method#run#0;class#console#0" expanded="false" /> <element signature="method#cList#0;class#console#0" expanded="false" />
<element signature="method#cKick#0;class#console#0" expanded="false" />
<element signature="method#cSend#0;class#console#0" expanded="false" />
<element signature="method#cHelp#0;class#console#0" expanded="false" />
<element signature="method#cInfo#0;class#console#0" expanded="false" />
<element signature="method#cRestart#0;class#console#0" expanded="false" />
</folding> </folding>
</state> </state>
</provider> </provider>
@ -940,6 +1052,7 @@
<folding> <folding>
<element signature="imports" expanded="true" /> <element signature="imports" expanded="true" />
<element signature="method#bytesToStringUTFCustom#0;class#client#0" expanded="false" /> <element signature="method#bytesToStringUTFCustom#0;class#client#0" expanded="false" />
<element signature="method#handshake#0;class#client#0" expanded="false" />
</folding> </folding>
</state> </state>
</provider> </provider>
@ -959,12 +1072,16 @@
<state relative-caret-position="578"> <state relative-caret-position="578">
<caret line="34" column="5" selection-start-line="34" selection-start-column="5" selection-end-line="34" selection-end-column="5" /> <caret line="34" column="5" selection-start-line="34" selection-start-column="5" selection-end-line="34" selection-end-column="5" />
<folding> <folding>
<element signature="imports" expanded="true" />
<element signature="method#consoleListner#0;class#console#0" expanded="false" /> <element signature="method#consoleListner#0;class#console#0" expanded="false" />
<element signature="method#out#0;class#console#0" expanded="false" /> <element signature="method#out#0;class#console#0" expanded="false" />
<element signature="method#socket#0;class#console#0" expanded="false" /> <element signature="method#socket#0;class#console#0" expanded="false" />
<element signature="method#debug#0;class#console#0" expanded="false" /> <element signature="method#debug#0;class#console#0" expanded="false" />
<element signature="method#run#0;class#console#0" expanded="false" /> <element signature="method#cList#0;class#console#0" expanded="false" />
<element signature="method#cKick#0;class#console#0" expanded="false" />
<element signature="method#cSend#0;class#console#0" expanded="false" />
<element signature="method#cHelp#0;class#console#0" expanded="false" />
<element signature="method#cInfo#0;class#console#0" expanded="false" />
<element signature="method#cRestart#0;class#console#0" expanded="false" />
</folding> </folding>
</state> </state>
</provider> </provider>
@ -976,6 +1093,7 @@
<folding> <folding>
<element signature="imports" expanded="true" /> <element signature="imports" expanded="true" />
<element signature="method#bytesToStringUTFCustom#0;class#client#0" expanded="false" /> <element signature="method#bytesToStringUTFCustom#0;class#client#0" expanded="false" />
<element signature="method#handshake#0;class#client#0" expanded="false" />
</folding> </folding>
</state> </state>
</provider> </provider>
@ -996,12 +1114,16 @@
<state relative-caret-position="1003"> <state relative-caret-position="1003">
<caret line="67" column="13" selection-start-line="67" selection-start-column="13" selection-end-line="67" selection-end-column="13" /> <caret line="67" column="13" selection-start-line="67" selection-start-column="13" selection-end-line="67" selection-end-column="13" />
<folding> <folding>
<element signature="imports" expanded="true" />
<element signature="method#consoleListner#0;class#console#0" expanded="false" /> <element signature="method#consoleListner#0;class#console#0" expanded="false" />
<element signature="method#out#0;class#console#0" expanded="false" /> <element signature="method#out#0;class#console#0" expanded="false" />
<element signature="method#socket#0;class#console#0" expanded="false" /> <element signature="method#socket#0;class#console#0" expanded="false" />
<element signature="method#debug#0;class#console#0" expanded="false" /> <element signature="method#debug#0;class#console#0" expanded="false" />
<element signature="method#run#0;class#console#0" expanded="false" /> <element signature="method#cList#0;class#console#0" expanded="false" />
<element signature="method#cKick#0;class#console#0" expanded="false" />
<element signature="method#cSend#0;class#console#0" expanded="false" />
<element signature="method#cHelp#0;class#console#0" expanded="false" />
<element signature="method#cInfo#0;class#console#0" expanded="false" />
<element signature="method#cRestart#0;class#console#0" expanded="false" />
</folding> </folding>
</state> </state>
</provider> </provider>
@ -1013,6 +1135,7 @@
<folding> <folding>
<element signature="imports" expanded="true" /> <element signature="imports" expanded="true" />
<element signature="method#bytesToStringUTFCustom#0;class#client#0" expanded="false" /> <element signature="method#bytesToStringUTFCustom#0;class#client#0" expanded="false" />
<element signature="method#handshake#0;class#client#0" expanded="false" />
</folding> </folding>
</state> </state>
</provider> </provider>
@ -1033,12 +1156,16 @@
<state relative-caret-position="1139"> <state relative-caret-position="1139">
<caret line="67" column="13" selection-start-line="67" selection-start-column="13" selection-end-line="67" selection-end-column="13" /> <caret line="67" column="13" selection-start-line="67" selection-start-column="13" selection-end-line="67" selection-end-column="13" />
<folding> <folding>
<element signature="imports" expanded="true" />
<element signature="method#consoleListner#0;class#console#0" expanded="false" /> <element signature="method#consoleListner#0;class#console#0" expanded="false" />
<element signature="method#out#0;class#console#0" expanded="false" /> <element signature="method#out#0;class#console#0" expanded="false" />
<element signature="method#socket#0;class#console#0" expanded="false" /> <element signature="method#socket#0;class#console#0" expanded="false" />
<element signature="method#debug#0;class#console#0" expanded="false" /> <element signature="method#debug#0;class#console#0" expanded="false" />
<element signature="method#run#0;class#console#0" expanded="false" /> <element signature="method#cList#0;class#console#0" expanded="false" />
<element signature="method#cKick#0;class#console#0" expanded="false" />
<element signature="method#cSend#0;class#console#0" expanded="false" />
<element signature="method#cHelp#0;class#console#0" expanded="false" />
<element signature="method#cInfo#0;class#console#0" expanded="false" />
<element signature="method#cRestart#0;class#console#0" expanded="false" />
</folding> </folding>
</state> </state>
</provider> </provider>
@ -1050,6 +1177,7 @@
<folding> <folding>
<element signature="imports" expanded="true" /> <element signature="imports" expanded="true" />
<element signature="method#bytesToStringUTFCustom#0;class#client#0" expanded="false" /> <element signature="method#bytesToStringUTFCustom#0;class#client#0" expanded="false" />
<element signature="method#handshake#0;class#client#0" expanded="false" />
</folding> </folding>
</state> </state>
</provider> </provider>
@ -1078,74 +1206,85 @@
</state> </state>
</provider> </provider>
</entry> </entry>
<entry file="jar://E:/ProfessionalPrograms/JDK8/src.zip!/java/util/ArrayList.java" />
<entry file="file://$PROJECT_DIR$/ctserver.xml" /> <entry file="file://$PROJECT_DIR$/ctserver.xml" />
<entry file="file://$PROJECT_DIR$/module_ctserver.xml" /> <entry file="file://$PROJECT_DIR$/module_ctserver.xml" />
<entry file="file://$PROJECT_DIR$/package-list" /> <entry file="file://$PROJECT_DIR$/package-list" />
<entry file="jar://E:/ProfessionalPrograms/JDK8/src.zip!/java/net/SocketInputStream.java" /> <entry file="jar://E:/ProfessionalPrograms/JDK8/src.zip!/java/net/SocketInputStream.java" />
<entry file="jar://$PROJECT_DIR$/lib/javax.json.jar!/javax/json/stream/JsonParser.class"> <entry file="jar://$PROJECT_DIR$/lib/javax.json.jar!/javax/json/stream/JsonParser.class">
<provider selected="true" editor-type-id="text-editor"> <provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="425"> <state relative-caret-position="374">
<caret line="30" column="16" selection-start-line="30" selection-start-column="16" selection-end-line="30" selection-end-column="16" /> <caret line="22" column="19" selection-start-line="22" selection-start-column="19" selection-end-line="22" selection-end-column="19" />
<folding /> <folding />
</state> </state>
</provider> </provider>
</entry> </entry>
<entry file="jar://E:/ProfessionalPrograms/JDK8/src.zip!/java/util/ArrayList.java"> <entry file="jar://C:/Program Files/Java/jdk1.8.0_102/src.zip!/java/util/ArrayList.java">
<provider selected="true" editor-type-id="text-editor"> <provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="181"> <state relative-caret-position="185">
<caret line="430" column="0" selection-start-line="430" selection-start-column="0" selection-end-line="430" selection-end-column="0" /> <caret line="430" column="0" selection-start-line="430" selection-start-column="0" selection-end-line="430" selection-end-column="0" />
<folding /> <folding />
</state> </state>
</provider> </provider>
</entry> </entry>
<entry file="file://$PROJECT_DIR$/src/ctServer.java"> <entry file="file://$PROJECT_DIR$/src/eventHandler.java">
<provider selected="true" editor-type-id="text-editor"> <provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="255"> <state relative-caret-position="530">
<caret line="15" column="16" selection-start-line="15" selection-start-column="16" selection-end-line="15" selection-end-column="16" /> <caret line="152" column="36" selection-start-line="152" selection-start-column="36" selection-end-line="152" selection-end-column="36" />
<folding> <folding>
<element signature="imports" expanded="true" /> <element signature="imports" expanded="true" />
<element signature="method#close#0;class#eventHandler#0" expanded="false" />
</folding> </folding>
</state> </state>
</provider> </provider>
</entry> </entry>
<entry file="file://$PROJECT_DIR$/src/socketInfo.java"> <entry file="file://$PROJECT_DIR$/src/client.java">
<provider selected="true" editor-type-id="text-editor"> <provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="-804"> <state relative-caret-position="340">
<caret line="72" column="53" selection-start-line="72" selection-start-column="34" selection-end-line="72" selection-end-column="53" /> <caret line="279" column="69" selection-start-line="279" selection-start-column="69" selection-end-line="279" selection-end-column="69" />
<folding /> <folding>
<element signature="imports" expanded="true" />
<element signature="method#bytesToStringUTFCustom#0;class#client#0" expanded="false" />
<element signature="method#handshake#0;class#client#0" expanded="false" />
</folding>
</state> </state>
</provider> </provider>
</entry> </entry>
<entry file="file://$PROJECT_DIR$/src/eventHandler.java"> <entry file="file://$PROJECT_DIR$/src/socketInfo.java">
<provider selected="true" editor-type-id="text-editor"> <provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="68"> <state relative-caret-position="530">
<caret line="4" column="0" selection-start-line="4" selection-start-column="0" selection-end-line="4" selection-end-column="0" /> <caret line="182" column="24" selection-start-line="182" selection-start-column="24" selection-end-line="182" selection-end-column="24" />
<folding /> <folding>
<element signature="imports" expanded="true" />
</folding>
</state> </state>
</provider> </provider>
</entry> </entry>
<entry file="file://$PROJECT_DIR$/src/console.java"> <entry file="file://$PROJECT_DIR$/src/ctServer.java">
<provider selected="true" editor-type-id="text-editor"> <provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="187"> <state relative-caret-position="102">
<caret line="11" column="4" selection-start-line="11" selection-start-column="4" selection-end-line="11" selection-end-column="4" /> <caret line="6" column="26" selection-start-line="6" selection-start-column="26" selection-end-line="6" selection-end-column="26" />
<folding> <folding>
<element signature="imports" expanded="true" /> <element signature="imports" expanded="true" />
<element signature="method#consoleListner#0;class#console#0" expanded="false" />
<element signature="method#out#0;class#console#0" expanded="false" />
<element signature="method#socket#0;class#console#0" expanded="false" />
<element signature="method#debug#0;class#console#0" expanded="false" />
<element signature="method#run#0;class#console#0" expanded="false" />
</folding> </folding>
</state> </state>
</provider> </provider>
</entry> </entry>
<entry file="file://$PROJECT_DIR$/src/client.java"> <entry file="file://$PROJECT_DIR$/src/console.java">
<provider selected="true" editor-type-id="text-editor"> <provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="-5"> <state relative-caret-position="17">
<caret line="98" column="33" selection-start-line="98" selection-start-column="33" selection-end-line="98" selection-end-column="33" /> <caret line="3" column="23" selection-start-line="3" selection-start-column="23" selection-end-line="3" selection-end-column="23" />
<folding> <folding>
<element signature="imports" expanded="true" /> <element signature="method#consoleListner#0;class#console#0" expanded="false" />
<element signature="method#bytesToStringUTFCustom#0;class#client#0" expanded="false" /> <element signature="method#out#0;class#console#0" expanded="false" />
<element signature="method#socket#0;class#console#0" expanded="false" />
<element signature="method#debug#0;class#console#0" expanded="false" />
<element signature="method#cList#0;class#console#0" expanded="false" />
<element signature="method#cKick#0;class#console#0" expanded="false" />
<element signature="method#cSend#0;class#console#0" expanded="false" />
<element signature="method#cHelp#0;class#console#0" expanded="false" />
<element signature="method#cInfo#0;class#console#0" expanded="false" />
<element signature="method#cRestart#0;class#console#0" expanded="false" />
</folding> </folding>
</state> </state>
</provider> </provider>

95
src/client.java

@ -1,5 +1,4 @@
import javax.json.Json; import javax.json.Json;
import javax.json.JsonObject;
import javax.json.stream.JsonParser; import javax.json.stream.JsonParser;
import javax.xml.bind.DatatypeConverter; import javax.xml.bind.DatatypeConverter;
import java.io.*; import java.io.*;
@ -18,62 +17,67 @@ public class client extends Thread {
private Socket socket; private Socket socket;
private OutputStream out; private OutputStream out;
private InputStream in; private InputStream in;
private Integer id; private Integer socketid;
private Boolean isClosing = false; private Boolean isClosing = false;
public void openSocket(Socket s) throws IOException { public void openSocket(Socket s) throws IOException {
socket = s; socket = s;
out = socket.getOutputStream(); out = socket.getOutputStream();
in = socket.getInputStream(); in = socket.getInputStream();
id = socketInfo.getNewID(); socketid = socketInfo.getNewID();
console.debug("Create new socket " + id); console.debug("Create new socket " + socketid);
socketInfo.create(this, id); socketInfo.create(this, socketid);
start(); start();
} }
public void run() { public void run() {
console.socket(id, "New connection"); console.socket(socketid, "New connection");
wsControl(); wsControl();
} }
public void close() { public void close() {
if(!socketInfo.isOnline(id)){ if(!socketInfo.isOnline(socketid)){
return; return;
} }
sendSocket("{\"fn\":\"close\",\"reason\":\"\"}");
try { try {
in.close(); in.close();
out.close(); out.close();
socket.close(); socket.close();
} catch (IOException e) { } catch (IOException e) {
} }
console.socket(id, "Disconnected"); console.socket(socketid, "Disconnected");
socketInfo.close(id); socketInfo.close(socketid);
} }
public void wsControl() { public void wsControl() {
handshake(); handshake();
if (!socketInfo.isHttpAuth(id)) { if (!socketInfo.isHttpAuth(socketid)) {
return; return;
} }
while (socketInfo.isOnline(id)) { String msg = readSocket();
// Получение сообщения parseInput(msg);
String msg = readSocket(); if(!socketInfo.isProtocolAuth(socketid)){socketInfo.checkProtocol(socketid);}
// Сохранение данных из сообщения if(!socketInfo.isProtocolAuth(socketid)){close(); return;}
eventHandler.connect(socketid);
while (socketInfo.isOnline(socketid)) {
msg = readSocket();
parseInput(msg); parseInput(msg);
// Проверка протокола
if(!socketInfo.isProtocolAuth(id)){socketInfo.checkProtocol(id);} int id = socketInfo.findSocket.bySID(socketid);
if(!socketInfo.isProtocolAuth(id)){close();} if(id == -1){return;}
//TODO: подключить Event Handler switch (socketInfo.EVENT.get(id)){
//TODO: проверить ROLE клиента case "play": eventHandler.play(socketid);
//TODO: выполнить событие в зависимости от ROLE клиента break;
//RoleChecker -> socketInfo case "pause": eventHandler.pause(socketid);
//eventFilter -> eventHandler break;
//eventFilter > switch > EVENT & ROLE case "next": eventHandler.next(socketid);
//eventFilter >> eventMaker >> client.socket break;
//TODO: убрать ECHO сообщение case "prev": eventHandler.prev(socketid);
sendSocket(msg); break;
case "wind": eventHandler.wind(socketid);
break;
}
} }
} }
@ -88,9 +92,9 @@ public class client extends Thread {
} }
private void handshake() { private void handshake() {
if(!socketInfo.isOnline(id)){close(); return;} if(!socketInfo.isOnline(socketid)){close(); return;}
try { try {
if (!socketInfo.isHttpAuth(id)) { if (!socketInfo.isHttpAuth(socketid)) {
socket.setSoTimeout(2000); socket.setSoTimeout(2000);
String data = new Scanner(in, "UTF-8").useDelimiter("\\r\\n\\r\\n").next(); String data = new Scanner(in, "UTF-8").useDelimiter("\\r\\n\\r\\n").next();
Matcher get = Pattern.compile("^GET").matcher(data); Matcher get = Pattern.compile("^GET").matcher(data);
@ -115,30 +119,29 @@ public class client extends Thread {
console.out("Server Error:", e.toString()); console.out("Server Error:", e.toString());
} }
socket.setSoTimeout(0); socket.setSoTimeout(0);
socketInfo.setHttpAuth(id, true); socketInfo.setHttpAuth(socketid, true);
console.socket(id, "Handshake accepted!"); console.socket(socketid, "Handshake accepted!");
} }
} }
} catch (SocketException e) { } catch (SocketException ignored) {
console.debug("исключение 22");
} catch (NoSuchElementException e) { } catch (NoSuchElementException e) {
console.socket(id, "Handshake Timeout (2000ms)"); console.socket(socketid, "Handshake Timeout (2000ms)");
socketInfo.setHttpAuth(id, false); socketInfo.setHttpAuth(socketid, false);
close(); close();
} catch(IllegalStateException e){ } catch(IllegalStateException e){
console.socket(id, "Bad handshake request!"); console.socket(socketid, "Bad handshake request!");
close(); close();
} }
} }
public Boolean sendSocket(String message) { public Boolean sendSocket(String message) {
if(!socketInfo.isOnline(id)){close(); return false;} if(!socketInfo.isOnline(socketid)){close(); return false;}
byte[] response; byte[] response;
byte[] r; byte[] r;
try { try {
response = message.getBytes("UTF-8"); response = message.getBytes("UTF-8");
} catch (UnsupportedEncodingException e) { } catch (UnsupportedEncodingException e) {
console.socket(id, "Unsupported encoding!"); console.socket(socketid, "Unsupported encoding!");
return false; return false;
} catch (NullPointerException e) { } catch (NullPointerException e) {
return false; return false;
@ -183,7 +186,7 @@ public class client extends Thread {
} }
public String readSocket() { public String readSocket() {
if(!socketInfo.isOnline(id)){close(); return null;} if(!socketInfo.isOnline(socketid)){close(); return null;}
String out = ""; String out = "";
try { try {
int[] MSG = new int[0]; int[] MSG = new int[0];
@ -248,13 +251,13 @@ public class client extends Thread {
console.out("Socket Exception", "Client socket is closed?! Closing socket connection!"); console.out("Socket Exception", "Client socket is closed?! Closing socket connection!");
close(); close();
} }
if(!socketInfo.isOnline(id)){close(); return null;} if(!socketInfo.isOnline(socketid)){close(); return null;}
console.socket(id, "Message: " + out); console.socket(socketid, "Получаю: " + out);
return out; return out;
} }
public Boolean parseInput(String input) { public Boolean parseInput(String input) {
if(!socketInfo.isOnline(id)){close();return false;} if(!socketInfo.isOnline(socketid)){close();return false;}
try { try {
String keyName = null; String keyName = null;
JsonParser jsonParser = Json.createParser(new StringReader(input)); JsonParser jsonParser = Json.createParser(new StringReader(input));
@ -265,14 +268,16 @@ public class client extends Thread {
keyName = jsonParser.getString(); keyName = jsonParser.getString();
break; break;
case VALUE_STRING: case VALUE_STRING:
socketInfo.setString(id, keyName, jsonParser.getString()); socketInfo.setString(socketid, keyName, jsonParser.getString());
break; break;
case VALUE_NUMBER: case VALUE_NUMBER:
socketInfo.setInteger(id, keyName, jsonParser.getInt()); socketInfo.setInteger(socketid, keyName, jsonParser.getBigDecimal());
break; break;
case VALUE_FALSE: case VALUE_FALSE:
socketInfo.setBoolean(socketid, keyName, false);
break; break;
case VALUE_TRUE: case VALUE_TRUE:
socketInfo.setBoolean(socketid, keyName, true);
break; break;
case VALUE_NULL: case VALUE_NULL:
// don't set anything // don't set anything
@ -284,7 +289,7 @@ public class client extends Thread {
} }
return true; return true;
}catch(NullPointerException e){ }catch(NullPointerException e){
console.socket(id,"Request parsing error!"); console.socket(socketid,"Request parsing error!");
return false; return false;
} }
} }

178
src/console.java

@ -2,7 +2,6 @@ import java.io.BufferedReader;
import java.io.IOException; import java.io.IOException;
import java.io.InputStreamReader; import java.io.InputStreamReader;
import java.time.Clock; import java.time.Clock;
import java.time.Instant;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.regex.Pattern; import java.util.regex.Pattern;
@ -13,6 +12,7 @@ public class console extends Thread{
private BufferedReader in; private BufferedReader in;
private String line; private String line;
private static Boolean hide = false;
public void consoleListner() throws IOException{ public void consoleListner() throws IOException{
in = new BufferedReader(new InputStreamReader(System.in)); in = new BufferedReader(new InputStreamReader(System.in));
@ -21,6 +21,7 @@ public class console extends Thread{
} }
public static void out(String parent, String msg){ public static void out(String parent, String msg){
if(hide){return;}
String out = "["; String out = "[";
out += Clock.systemUTC().instant().toString(); out += Clock.systemUTC().instant().toString();
out += "|"; out += "|";
@ -31,6 +32,7 @@ public class console extends Thread{
} }
public static void socket(Integer socketId, String msg){ public static void socket(Integer socketId, String msg){
if(hide){return;}
String out = "["; String out = "[";
out += Clock.systemUTC().instant().toString(); out += Clock.systemUTC().instant().toString();
out += "|Socket "; out += "|Socket ";
@ -41,6 +43,7 @@ public class console extends Thread{
} }
public static void debug(String msg){ public static void debug(String msg){
if(hide){return;}
String out = "["; String out = "[";
out += Clock.systemUTC().instant().toString(); out += Clock.systemUTC().instant().toString();
out += "|DEBUG]: "; out += "|DEBUG]: ";
@ -49,84 +52,33 @@ public class console extends Thread{
} }
public void run() { public void run() {
while (line.equalsIgnoreCase("quit") == false) { console.out("Server", "Welcome to the ctServer/build25");
while (line.equalsIgnoreCase("/stop") == false) {
try{ try{
line = in.readLine(); line = in.readLine();
Integer sid;
Integer id;
Pattern main = Pattern.compile(" "); Pattern main = Pattern.compile(" ");
String[] sx = main.split(line); String[] sx = main.split(line);
switch (sx[0]){ switch (sx[0]){
case "/list": case "/list":
console.out("Server","/list"); cList();
for(int i = 0; socketInfo.SOCKETID.size() > i; i++){
sid = socketInfo.SOCKETID.get(i);
if(socketInfo.protocolAuth.get(i)) {
console.socket(sid,"VKID " + socketInfo.VKID.get(i)
+ " PROTOCOL " + socketInfo.PROTOCOL.get(i)
+ " EVENT " + socketInfo.EVENT.get(i)
+ " PARTYID " + socketInfo.PARTYID.get(i)
+ " TRACKDURATION " + socketInfo.DURATION.get(i));
}else{
console.socket(sid,"Protocol not checked!");
}
}
break; break;
case "/kick": case "/kick":
sid = Integer.valueOf(sx[1]); cKick(sx);
if(socketInfo.findSocket.bySID(Integer.valueOf(sx[1])) != -1){
socketInfo.getClient(sid).close();
}
break; break;
case "/send": case "/send":
sid = socketInfo.findSocket.bySID(Integer.valueOf(sx[1])); cSend(sx);
if(sid != -1){
String msg = "";
for (int i = 2; i < sx.length ; i++) {
msg += " ";
msg += sx[i];
}
socketInfo.getClient(Integer.valueOf(sx[1])).sendSocket(msg);
}
break; break;
case "/info": case "/info":
if(sx.length < 3){ cInfo(sx);
console.out("Server","/info [pid/sid] <id>");
} else {
switch (sx[1]) {
case "sid":
sid = Integer.valueOf(sx[2]);
id = socketInfo.findSocket.bySID(sid);
if(id == -1){break;}
console.socket(sid,"VKID " + socketInfo.VKID.get(id)
+ " PROTOCOL " + socketInfo.PROTOCOL.get(id)
+ " EVENT " + socketInfo.EVENT.get(id)
+ " PARTYID " + socketInfo.PARTYID.get(id)
+ " TRACKDURATION " + socketInfo.DURATION.get(id));
break;
case "pid":
ArrayList<Integer> a = socketInfo.findSocket.byPID(Integer.valueOf(sx[2]));
for (int i = 0; i < a.size(); i++) {
id = a.get(i);
console.socket(socketInfo.SOCKETID.get(id),"VKID " + socketInfo.VKID.get(id)
+ " PROTOCOL " + socketInfo.PROTOCOL.get(id)
+ " EVENT " + socketInfo.EVENT.get(id)
+ " PARTYID " + socketInfo.PARTYID.get(id)
+ " TRACKDURATION " + socketInfo.DURATION.get(id));
}
break;
default:
console.out("Server", "/info [pid/sid] <id>");
break;
}
}
break; break;
case "/help": case "/help":
console.out("Server","/kick [socketid] для отключения сокета от сервера"); cHelp();
console.out("Server","/list для отображения всех клиентов"); break;
console.out("Server","/info pid/sid [id] для отображения полной информации о данном клиенте"); case "/hide":
console.out("Server","/send [socketid] [msg] отладочная команда"); cHide();
console.out("Server","ctServer Proto Defend Development 2016"); break;
case "/restart":
cRestart();
break; break;
default: console.out("Server","Введите /help для помощи"); default: console.out("Server","Введите /help для помощи");
} }
@ -137,5 +89,101 @@ public class console extends Thread{
console.out("Console","Hey guy, don't be so crazy!!!"); console.out("Console","Hey guy, don't be so crazy!!!");
} }
} }
for (int i = 0; i < socketInfo.SOCKETID.size(); i++) {
socketInfo.CLIENT.get(i).close();
}
}
private void cHide() {
if(!hide){hide = true;} else {hide = false;}
}
private void cList() {
Integer sid;
console.out("Server","/list");
for(int i = 0; socketInfo.SOCKETID.size() > i; i++){
sid = socketInfo.SOCKETID.get(i);
if(socketInfo.protocolAuth.get(i)) {
console.socket(sid,"VKID " + socketInfo.VKID.get(i)
+ " PROTOCOL " + socketInfo.PROTOCOL.get(i)
+ " EVENT " + socketInfo.EVENT.get(i)
+ " PARTYID " + socketInfo.PARTYID.get(i)
+ " TIME " + socketInfo.TIME.get(i)
+ " TRACKDURATION " + socketInfo.DURATION.get(i));
}else{
console.socket(sid,"Protocol not checked!");
}
}
}
private void cKick(String[] sx) {
Integer sid;
sid = Integer.valueOf(sx[1]);
if(socketInfo.findSocket.bySID(Integer.valueOf(sx[1])) != -1){
socketInfo.getClient(sid).close();
}
}
private void cSend(String[] sx) {
Integer sid;
sid = socketInfo.findSocket.bySID(Integer.valueOf(sx[1]));
if(sid != -1){
String msg = "";
for (int i = 2; i < sx.length ; i++) {
msg += " ";
msg += sx[i];
}
socketInfo.getClient(Integer.valueOf(sx[1])).sendSocket(msg);
}
}
private void cHelp() {
console.out("Server","/kick [socketid] для отключения сокета от сервера");
console.out("Server","/list для отображения всех клиентов");
console.out("Server","/info pid/sid [id] для отображения полной информации о данном клиенте");
console.out("Server","/send [socketid] [msg] отладочная команда");
console.out("Server","ctServer Proto Defend Development 2016");
}
private void cInfo(String[] sx) {
Integer sid;
Integer id;
if(sx.length < 3){
console.out("Server","/info [pid/sid] <id>");
} else {
switch (sx[1]) {
case "sid":
sid = Integer.valueOf(sx[2]);
id = socketInfo.findSocket.bySID(sid);
if(id == -1){break;}
console.socket(sid,"VKID " + socketInfo.VKID.get(id)
+ " PROTOCOL " + socketInfo.PROTOCOL.get(id)
+ " EVENT " + socketInfo.EVENT.get(id)
+ " PARTYID " + socketInfo.PARTYID.get(id)
+ " TRACKDURATION " + socketInfo.DURATION.get(id));
break;
case "pid":
ArrayList<Integer> a = socketInfo.findSocket.byPID(Integer.valueOf(sx[2]));
for (int i = 0; i < a.size(); i++) {
id = a.get(i);
console.socket(socketInfo.SOCKETID.get(id),"VKID " + socketInfo.VKID.get(id)
+ " PROTOCOL " + socketInfo.PROTOCOL.get(id)
+ " EVENT " + socketInfo.EVENT.get(id)
+ " PARTYID " + socketInfo.PARTYID.get(id)
+ " TRACKDURATION " + socketInfo.DURATION.get(id));
}
break;
default:
console.out("Server", "/info [pid/sid] <id>");
break;
}
}
}
private void cRestart(){
for (int i = 0; i < socketInfo.SOCKETID.size(); i++) {
socketInfo.CLIENT.get(i).sendSocket("{\"EVENT\":\"RESTART\"}");
}
System.exit(99);
} }
} }

5
src/ctServer.java

@ -5,13 +5,10 @@ public class ctServer {
public static void main(String[] args) throws IOException{ public static void main(String[] args) throws IOException{
socketInfo.init(); socketInfo.init();
//TODO: оптимизация идентификаторов сокетов
try{ try{
new console().consoleListner(); new console().consoleListner();
} }
catch (IOException ignored){ catch (IOException ignored){}
}
int port = 80; int port = 80;
console.out("Socket Port", port+""); console.out("Socket Port", port+"");
ServerSocket ss = new ServerSocket(port); ServerSocket ss = new ServerSocket(port);

153
src/eventHandler.java

@ -1,6 +1,157 @@
import jdk.nashorn.internal.parser.JSONParser;
import javax.json.Json;
import javax.json.JsonObject;
import javax.json.JsonObjectBuilder;
import java.util.ArrayList;
/** /**
* Created by itsmy on 15.08.2016. * Created by itsmy on 15.08.2016.
*/ */
public class eventHandler extends client { public class eventHandler {
public static synchronized void connect(Integer sid){
JsonObjectBuilder creator = Json.createObjectBuilder();
creator.add("EVENT","SERVICE");
int id = socketInfo.findSocket.bySID(sid);
if(id == -1){return;}
ArrayList<Integer> a = socketInfo.findSocket.byPID(socketInfo.PARTYID.get(id));
if(a.size() == 1) { //Если клиент первым подключился, то он управляет
creator.add("ROLE", 0);
creator.add("ONLINE", 0);
socketInfo.ROLE.set(id, 0);
JsonObject cc = creator.build();
socketInfo.CLIENT.get(id).sendSocket(cc.toString());
} else if(a.size() > 1) { //Если клиент уже не первый, то всем остальным клиентам идет рассылка о новом подключении
socketInfo.ROLE.set(id, 1);
creator.add("ONLINE" , a.size()-1);
for (int i = 0; i < a.size(); i++) {
if(socketInfo.ROLE.get(i) == 0){
JsonObject cc = creator.build();
socketInfo.CLIENT.get(a.get(i)).sendSocket(cc.toString());
}
else{
JsonObjectBuilder listner = Json.createObjectBuilder();
listner.add("EVENT","SERVICE");
listner.add("ROLE", 1);
listner.add("ONLINE" , a.size()-1);
JsonObject lc = listner.build();
socketInfo.CLIENT.get(a.get(i)).sendSocket(lc.toString());
}
}
}
}
public static void close(Integer sid){
JsonObjectBuilder c = Json.createObjectBuilder();
c.add("EVENT","SERVICE");
int id = socketInfo.findSocket.bySID(sid);
ArrayList<Integer> a = socketInfo.findSocket.byPID(socketInfo.PARTYID.get(id));
if(a.size() < 2){return;}
if(socketInfo.ROLE.get(id) == 0){
for (int i = 0; i < socketInfo.ROLE.size() ; i++) {
if(id != i){
socketInfo.ROLE.set(i, 0);
JsonObjectBuilder creator = Json.createObjectBuilder();
creator.add("EVENT","SERVICE");
creator.add("ROLE", 1);
creator.add("ONLINE" , a.size()-2);
JsonObject lc = creator.build();
socketInfo.CLIENT.get(i).sendSocket(lc.toString());
break;
}
}
}
for (int i = 0; i < a.size(); i++) {
// JsonObjectBuilder listner = Json.createObjectBuilder();
// listner.add("EVENT","SERVICE");
// listner.add("ROLE", 1);
// listner.add("ONLINE" , a.size()-1);
// JsonObject lc = listner.build();
// socketInfo.CLIENT.get(i).sendSocket(lc.toString());
}
}
public static void play(Integer sid){
int id = socketInfo.findSocket.bySID(sid);
if(id == -1){return;}
JsonObjectBuilder creator = Json.createObjectBuilder();
creator.add("EVENT", "play");
creator.add("tm",socketInfo.TIME.get(id));
creator.add("tI", socketInfo.TRACKID.get(id));
creator.add("li", "main");
creator.add("tT", socketInfo.TRACKTIME.get(id));
creator.add("tD", socketInfo.DURATION.get(id));
creator.add("aP", socketInfo.AUTOPLAY.get(id));
eventSender(id,creator);
}
public static void next(Integer sid){
int id = socketInfo.findSocket.bySID(sid);
if(id == -1){return;}
JsonObjectBuilder creator = Json.createObjectBuilder();
creator.add("EVENT", "next");
creator.add("tm",socketInfo.TIME.get(id));
creator.add("tI", socketInfo.TRACKID.get(id));
creator.add("li", "main");
creator.add("tT", socketInfo.TRACKTIME.get(id));
creator.add("tD", socketInfo.DURATION.get(id));
creator.add("aP", socketInfo.AUTOPLAY.get(id));
eventSender(id,creator);
}
public static void prev(Integer sid){
int id = socketInfo.findSocket.bySID(sid);
if(id == -1){return;}
JsonObjectBuilder creator = Json.createObjectBuilder();
creator.add("EVENT", "prev");
creator.add("tm",socketInfo.TIME.get(id));
creator.add("tI", socketInfo.TRACKID.get(id));
creator.add("li", "main");
creator.add("tT", socketInfo.TRACKTIME.get(id));
creator.add("tD", socketInfo.DURATION.get(id));
creator.add("aP", socketInfo.AUTOPLAY.get(id));
eventSender(id,creator);
}
public static void pause(Integer sid){
int id = socketInfo.findSocket.bySID(sid);
if(id == -1){return;}
JsonObjectBuilder creator = Json.createObjectBuilder();
creator.add("EVENT", "pause");
creator.add("tm",socketInfo.TIME.get(id));
creator.add("tI", socketInfo.TRACKID.get(id));
creator.add("li", "main");
creator.add("tT", socketInfo.TRACKTIME.get(id));
creator.add("tD", socketInfo.DURATION.get(id));
creator.add("aP", socketInfo.AUTOPLAY.get(id));
eventSender(id,creator);
}
public static void eventSender(Integer id, JsonObjectBuilder creator){
ArrayList<Integer> a = socketInfo.findSocket.byPID(socketInfo.PARTYID.get(id));
for (int i = 0; i < a.size(); i++) {
JsonObject c = creator.build();
socketInfo.CLIENT.get(a.get(i)).sendSocket(c.toString());
}
}
public static void wind(Integer sid){
int id = socketInfo.findSocket.bySID(sid);
if(id == -1){return;}
JsonObjectBuilder creator = Json.createObjectBuilder();
creator.add("EVENT", "wind");
creator.add("tm",socketInfo.TIME.get(id));
creator.add("tI", socketInfo.TRACKID.get(id));
creator.add("tT", socketInfo.TRACKTIME.get(id));
creator.add("tD", socketInfo.DURATION.get(id));
creator.add("ps", false);
eventSender(id,creator);
}
} }

45
src/socketInfo.java

@ -1,5 +1,6 @@
import com.sun.istack.internal.NotNull; import com.sun.istack.internal.NotNull;
import java.math.BigDecimal;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Arrays; import java.util.Arrays;
import java.util.function.BooleanSupplier; import java.util.function.BooleanSupplier;
@ -8,9 +9,12 @@ import java.util.function.BooleanSupplier;
* Created by itsmy_000 on 13.08.2016. * Created by itsmy_000 on 13.08.2016.
*/ */
public class socketInfo { public class socketInfo {
public static ArrayList<String> ROLE, PROTOCOL, EVENT, TRACKID; // public enum EVENT{PLAY,NEXT,REWIND,PAUSE,PREV,SCROB}
public static ArrayList<Integer> VKID, TIME, SOCKETID, PARTYID, DURATION; // public static ArrayList<EVENT> EVENTS;
public static ArrayList<Boolean> ONLINE, httpAuth, protocolAuth; public static ArrayList<BigDecimal> TIME, TRACKTIME;
public static ArrayList<String> PROTOCOL, EVENT, TRACKID;
public static ArrayList<Integer> ROLE, VKID, SOCKETID, PARTYID, DURATION;
public static ArrayList<Boolean> ONLINE, httpAuth, protocolAuth, AUTOPLAY;
public static ArrayList<client> CLIENT; public static ArrayList<client> CLIENT;
public static Integer sid; public static Integer sid;
@ -19,6 +23,7 @@ public class socketInfo {
sid = 0; sid = 0;
VKID = new ArrayList<>(); VKID = new ArrayList<>();
TIME = new ArrayList<>(); TIME = new ArrayList<>();
TRACKTIME = new ArrayList<>();
ROLE = new ArrayList<>(); ROLE = new ArrayList<>();
EVENT = new ArrayList<>(); EVENT = new ArrayList<>();
CLIENT = new ArrayList<>(); CLIENT = new ArrayList<>();
@ -30,12 +35,14 @@ public class socketInfo {
ONLINE = new ArrayList<>(); ONLINE = new ArrayList<>();
httpAuth = new ArrayList<>(); httpAuth = new ArrayList<>();
protocolAuth = new ArrayList<>(); protocolAuth = new ArrayList<>();
AUTOPLAY = new ArrayList<>();
} }
public static void create(client c, Integer sid){ public static void create(client c, Integer sid){
VKID.add(0); VKID.add(0);
TIME.add(0); TIME.add(BigDecimal.ZERO);
ROLE.add(""); TRACKTIME.add(BigDecimal.ZERO);
ROLE.add(1);
EVENT.add(""); EVENT.add("");
ONLINE.add(true); ONLINE.add(true);
CLIENT.add(c); CLIENT.add(c);
@ -46,6 +53,7 @@ public class socketInfo {
SOCKETID.add(sid); SOCKETID.add(sid);
httpAuth.add(false); httpAuth.add(false);
protocolAuth.add(false); protocolAuth.add(false);
AUTOPLAY.add(false);
} }
public static void close(Integer sid){ public static void close(Integer sid){
@ -57,12 +65,14 @@ public class socketInfo {
TRACKID.remove(s); TRACKID.remove(s);
SOCKETID.remove(s); SOCKETID.remove(s);
TIME.remove(s); TIME.remove(s);
TRACKTIME.remove(s);
DURATION.remove(s); DURATION.remove(s);
PARTYID.remove(s); PARTYID.remove(s);
CLIENT.remove(s); CLIENT.remove(s);
ONLINE.remove(s); ONLINE.remove(s);
httpAuth.remove(s); httpAuth.remove(s);
protocolAuth.remove(s); protocolAuth.remove(s);
AUTOPLAY.remove(s);
} }
public static Integer getNewID(){ public static Integer getNewID(){
@ -136,7 +146,7 @@ public class socketInfo {
int s = findSocket.bySID(sid); int s = findSocket.bySID(sid);
if (s == -1) return; if (s == -1) return;
switch (keyName) { switch (keyName) {
case "fn": case "EVENT":
EVENT.set(s, value); EVENT.set(s, value);
break; break;
case "tI": case "tI":
@ -148,18 +158,31 @@ public class socketInfo {
} }
} }
public static void setInteger(Integer sid, String keyName, Integer value){ public static void setInteger(Integer sid, String keyName, BigDecimal value){
int s = findSocket.bySID(sid); int s = findSocket.bySID(sid);
if(s == -1) return; if(s == -1) return;
switch (keyName){ switch (keyName){
case "vk_id": VKID.set(s, value); case "vk_id": VKID.set(s, value.intValueExact());
break; break;
case "tT": TIME.set(s, value); case "tm": TIME.set(s, value);
break; break;
case "partyId": PARTYID.set(s, value); case "tT": TRACKTIME.set(s, value);
break; break;
case "tD": DURATION.set(s, value); case "partyId": PARTYID.set(s, value.intValueExact());
break;
case "tD": DURATION.set(s, value.intValueExact());
break; break;
} }
} }
public static void setBoolean(Integer sid, String keyName, Boolean value){
int s = findSocket.bySID(sid);
if(s == -1) return;
switch (keyName) {
case "aP":
AUTOPLAY.set(s, value.booleanValue());
break;
}
}
} }

Loading…
Cancel
Save