Browse Source

Release 21

master
Defend 8 years ago
parent
commit
bd514ab4b3
  1. 7
      .idea/misc.xml
  2. 237
      .idea/workspace (1).xml
  3. 210
      .idea/workspace.xml
  4. 162
      src/client.java
  5. 30
      src/console.java
  6. 42
      src/ctServer.java
  7. 41
      src/socketInfo.java

7
.idea/misc.xml

@ -59,13 +59,6 @@
<option name="OPEN_IN_BROWSER" value="true" />
<option name="OPTION_INCLUDE_LIBS" value="false" />
</component>
<component name="MavenImportPreferences">
<option name="generalSettings">
<MavenGeneralSettings>
<option name="mavenHome" value="Bundled (Maven 3)" />
</MavenGeneralSettings>
</option>
</component>
<component name="ProjectLevelVcsManager" settingsEditedManually="false">
<OptionsSetting value="true" id="Add" />
<OptionsSetting value="true" id="Remove" />

237
.idea/workspace (1).xml

@ -19,6 +19,14 @@
<component name="CreatePatchCommitExecutor">
<option name="PATCH_PATH" value="" />
</component>
<component name="DatabaseView">
<option name="GROUP_SCHEMA" value="true" />
<option name="GROUP_CONTENTS" value="false" />
<option name="SORT_POSITIONED" value="false" />
<option name="SHOW_TABLE_DETAILS" value="true" />
<option name="SHOW_EMPTY_GROUPS" value="false" />
<option name="AUTO_SCROLL_FROM_SOURCE" value="false" />
</component>
<component name="ExecutionTargetManager" SELECTED_TARGET="default_target" />
<component name="FavoritesManager">
<favorites_list name="ctServer" />
@ -28,8 +36,8 @@
<file leaf-file-name="ctServer.java" pinned="false" current-in-tab="false">
<entry file="file://$PROJECT_DIR$/src/ctServer.java">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="714">
<caret line="54" column="21" selection-start-line="54" selection-start-column="21" selection-end-line="54" selection-end-column="21" />
<state relative-caret-position="17">
<caret line="1" column="17" selection-start-line="1" selection-start-column="17" selection-end-line="1" selection-end-column="17" />
<folding>
<element signature="imports" expanded="true" />
</folding>
@ -37,11 +45,11 @@
</provider>
</entry>
</file>
<file leaf-file-name="console.java" pinned="false" current-in-tab="true">
<entry file="file://$PROJECT_DIR$/src/console.java">
<file leaf-file-name="socketInfo.java" pinned="false" current-in-tab="false">
<entry file="file://$PROJECT_DIR$/src/socketInfo.java">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="161">
<caret line="46" column="0" selection-start-line="46" selection-start-column="0" selection-end-line="46" selection-end-column="0" />
<state relative-caret-position="-629">
<caret line="5" column="3" selection-start-line="5" selection-start-column="3" selection-end-line="5" selection-end-column="3" />
<folding>
<element signature="imports" expanded="true" />
</folding>
@ -52,8 +60,20 @@
<file leaf-file-name="client.java" pinned="false" current-in-tab="false">
<entry file="file://$PROJECT_DIR$/src/client.java">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="195">
<caret line="62" column="50" selection-start-line="62" selection-start-column="50" selection-end-line="62" selection-end-column="50" />
<state relative-caret-position="471">
<caret line="285" column="29" selection-start-line="285" selection-start-column="29" selection-end-line="285" selection-end-column="29" />
<folding>
<element signature="imports" expanded="true" />
</folding>
</state>
</provider>
</entry>
</file>
<file leaf-file-name="console.java" pinned="false" current-in-tab="true">
<entry file="file://$PROJECT_DIR$/src/console.java">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="29">
<caret line="51" column="82" selection-start-line="51" selection-start-column="82" selection-end-line="51" selection-end-column="82" />
<folding>
<element signature="imports" expanded="true" />
</folding>
@ -80,9 +100,12 @@
<option name="CHANGED_PATHS">
<list>
<option value="$PROJECT_DIR$/src/main.java" />
<option value="$PROJECT_DIR$/ctServer.iml" />
<option value="$PROJECT_DIR$/src/ctServer.java" />
<option value="$PROJECT_DIR$/src/console.java" />
<option value="$APPLICATION_CONFIG_DIR$/consoles/db/cf3e1e55-303c-4850-a301-239177a61e9f/console.sql" />
<option value="$PROJECT_DIR$/src/client.java" />
<option value="$PROJECT_DIR$/src/socketInfo.java" />
</list>
</option>
</component>
@ -92,11 +115,21 @@
<detection-done>true</detection-done>
<sorting>DEFINITION_ORDER</sorting>
</component>
<component name="MavenImportPreferences">
<option name="generalSettings">
<MavenGeneralSettings>
<option name="mavenHome" value="Bundled (Maven 3)" />
</MavenGeneralSettings>
</option>
</component>
<component name="MavenProjectNavigator">
<treeState />
</component>
<component name="ProjectFrameBounds">
<option name="x" value="-8" />
<option name="y" value="-8" />
<option name="width" value="1296" />
<option name="height" value="1010" />
<option name="width" value="1936" />
<option name="height" value="1066" />
</component>
<component name="ProjectLevelVcsManager" settingsEditedManually="false">
<OptionsSetting value="true" id="Add" />
@ -123,7 +156,7 @@
<foldersAlwaysOnTop value="true" />
</navigator>
<panes>
<pane id="Scratches" />
<pane id="Scope" />
<pane id="ProjectPane">
<subPane>
<PATH>
@ -131,6 +164,10 @@
<option name="myItemId" value="ctServer" />
<option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.ProjectViewProjectNode" />
</PATH_ELEMENT>
<PATH_ELEMENT>
<option name="myItemId" value="External Libraries" />
<option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.ExternalLibrariesNode" />
</PATH_ELEMENT>
</PATH>
<PATH>
<PATH_ELEMENT>
@ -142,10 +179,38 @@
<option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.PsiDirectoryNode" />
</PATH_ELEMENT>
</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="src" />
<option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.PsiDirectoryNode" />
</PATH_ELEMENT>
</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>
</subPane>
</pane>
<pane id="Scratches" />
<pane id="PackagesPane" />
<pane id="Scope" />
</panes>
</component>
<component name="PropertiesComponent">
@ -159,7 +224,7 @@
<property name="GenerateAntBuildDialog.outputFileNameProperty" value="ctserver" />
<property name="last_opened_file_path" value="$PROJECT_DIR$" />
</component>
<component name="RunManager" selected="Application.Unnamed">
<component name="RunManager" selected="Application.Debug">
<configuration default="true" type="#com.intellij.j2meplugin.run.J2MEConfigurationType" factoryName="J2ME">
<module name="" />
<USER_OPTIONS />
@ -601,7 +666,8 @@
<configuration default="true" type="osgi.bnd.run" factoryName="Test Launcher (JUnit)">
<method />
</configuration>
<configuration default="false" name="Unnamed" type="Application" factoryName="Application">
<configuration default="false" name="Debug" type="Application" factoryName="Application" singleton="true">
<output_file is_save="true" />
<extension name="coverage" enabled="false" merge="false" sample_coverage="true" runner="idea" />
<option name="MAIN_CLASS_NAME" value="ctServer" />
<option name="VM_PARAMETERS" value="" />
@ -617,7 +683,7 @@
<method />
</configuration>
<list size="1">
<item index="0" class="java.lang.String" itemvalue="Application.Unnamed" />
<item index="0" class="java.lang.String" itemvalue="Application.Debug" />
</list>
</component>
<component name="ShelveChangesManager" show_recycled="false">
@ -637,35 +703,45 @@
<workItem from="1470739295224" duration="18435000" />
<workItem from="1470845742191" duration="18554000" />
<workItem from="1470936508138" duration="9814000" />
<workItem from="1470992276279" duration="9337000" />
<workItem from="1470992276279" duration="63044000" />
<workItem from="1471163816519" duration="11233000" />
</task>
<servers />
</component>
<component name="TimeTrackingManager">
<option name="totallyTimeSpent" value="87125000" />
<option name="totallyTimeSpent" value="152065000" />
</component>
<component name="TodoView">
<todo-panel id="selected-file">
<is-autoscroll-to-source value="true" />
</todo-panel>
<todo-panel id="all">
<are-packages-shown value="true" />
<is-autoscroll-to-source value="true" />
</todo-panel>
</component>
<component name="ToolWindowManager">
<frame x="-8" y="-8" width="1296" height="1010" extended-state="6" />
<frame x="-8" y="-8" width="1936" height="1066" extended-state="6" />
<editor active="false" />
<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="TODO" 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="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.3288889" sideWeight="0.4792111" order="7" 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="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="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="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.32995737" 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="Run" active="true" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="true" show_stripe_button="true" weight="0.3876853" 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.36441585" sideWeight="0.45550162" order="2" 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="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="Project" active="false" anchor="left" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="true" show_stripe_button="true" weight="0.1302589" 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="Project" active="false" anchor="left" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="true" show_stripe_button="true" weight="0.12846482" 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.32995737" sideWeight="0.5" order="3" 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="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.39935064" 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.39871383" sideWeight="0.47708333" order="3" 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="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="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" />
@ -673,7 +749,8 @@
<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="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.3294979" sideWeight="0.5" order="1" side_tool="false" content_ui="tabs" />
<window_info id="Database Console" 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="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>
</component>
<component name="Vcs.Log.UiProperties">
@ -689,7 +766,7 @@
</component>
<component name="XDebuggerManager">
<breakpoint-manager>
<option name="time" value="33" />
<option name="time" value="42" />
</breakpoint-manager>
<watches-manager />
</component>
@ -698,6 +775,46 @@
<option name="FILTER_TARGETS" value="false" />
</component>
<component name="editorHistoryManager">
<entry file="file://$PROJECT_DIR$/src/ctServer.java">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="17">
<caret line="1" column="17" selection-start-line="1" selection-start-column="17" selection-end-line="1" selection-end-column="17" />
<folding>
<element signature="imports" expanded="true" />
</folding>
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/src/socketInfo.java">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="1615">
<caret line="95" column="5" selection-start-line="95" selection-start-column="5" selection-end-line="95" selection-end-column="5" />
<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="1003">
<caret line="59" column="13" selection-start-line="59" selection-start-column="13" selection-end-line="59" selection-end-column="13" />
<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="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/ctServer.java">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="0">
@ -821,38 +938,72 @@
</provider>
</entry>
<entry file="jar://E:/ProfessionalPrograms/JDK8/src.zip!/java/lang/Thread.java" />
<entry file="file://$PROJECT_DIR$/ctServer.iml">
<entry file="file://$PROJECT_DIR$/.idea/copyright/profiles_settings.xml">
<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" />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/.idea/copyright/profiles_settings.xml">
<entry file="file://$PROJECT_DIR$/src/package-info.java" />
<entry file="jar://E:/ProfessionalPrograms/JDK8/src.zip!/java/lang/Thread.java" />
<entry file="jar://E:/ProfessionalPrograms/JDK8/src.zip!/java/util/ArrayList.java" />
<entry file="file://$PROJECT_DIR$/ctserver.xml" />
<entry file="file://$PROJECT_DIR$/module_ctserver.xml" />
<entry file="file://$PROJECT_DIR$/package-list" />
<entry file="jar://E:/ProfessionalPrograms/JDK8/src.zip!/java/net/SocketInputStream.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">
<state relative-caret-position="169">
<caret line="652" column="0" selection-start-line="652" selection-start-column="0" selection-end-line="652" selection-end-column="0" />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/src/socketInfo.java___jb_tmp___" />
<entry file="jar://C:/Program Files/Java/jdk1.8.0_102/src.zip!/java/lang/Boolean.java">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="188">
<caret line="42" column="19" selection-start-line="42" selection-start-column="19" selection-end-line="42" selection-end-column="26" />
<folding />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/ctserver.properties">
<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" />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/src/package-info.java" />
<entry file="jar://E:/ProfessionalPrograms/JDK8/src.zip!/java/lang/Thread.java" />
<entry file="file://$PROJECT_DIR$/ctserver.properties">
<entry file="file://$PROJECT_DIR$/ctServer.iml">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="170">
<caret line="10" column="12" selection-start-line="10" selection-start-column="12" selection-end-line="10" selection-end-column="12" />
</state>
</provider>
</entry>
<entry file="file://$APPLICATION_CONFIG_DIR$/consoles/db/cf3e1e55-303c-4850-a301-239177a61e9f/console.sql">
<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 />
</state>
</provider>
</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$/module_ctserver.xml" />
<entry file="file://$PROJECT_DIR$/package-list" />
<entry file="jar://E:/ProfessionalPrograms/JDK8/src.zip!/java/net/SocketInputStream.java" />
<entry file="file://$PROJECT_DIR$/src/ctServer.java">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="714">
<caret line="54" column="21" selection-start-line="54" selection-start-column="21" selection-end-line="54" selection-end-column="21" />
<state relative-caret-position="17">
<caret line="1" column="17" selection-start-line="1" selection-start-column="17" selection-end-line="1" selection-end-column="17" />
<folding>
<element signature="imports" expanded="true" />
</folding>
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/src/socketInfo.java">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="-629">
<caret line="5" column="3" selection-start-line="5" selection-start-column="3" selection-end-line="5" selection-end-column="3" />
<folding>
<element signature="imports" expanded="true" />
</folding>
@ -861,8 +1012,8 @@
</entry>
<entry file="file://$PROJECT_DIR$/src/client.java">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="195">
<caret line="62" column="50" selection-start-line="62" selection-start-column="50" selection-end-line="62" selection-end-column="50" />
<state relative-caret-position="471">
<caret line="285" column="29" selection-start-line="285" selection-start-column="29" selection-end-line="285" selection-end-column="29" />
<folding>
<element signature="imports" expanded="true" />
</folding>
@ -871,8 +1022,8 @@
</entry>
<entry file="file://$PROJECT_DIR$/src/console.java">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="161">
<caret line="46" column="0" selection-start-line="46" selection-start-column="0" selection-end-line="46" selection-end-column="0" />
<state relative-caret-position="29">
<caret line="51" column="82" selection-start-line="51" selection-start-column="82" selection-end-line="51" selection-end-column="82" />
<folding>
<element signature="imports" expanded="true" />
</folding>

210
.idea/workspace.xml

@ -28,8 +28,8 @@
<file leaf-file-name="ctServer.java" pinned="false" current-in-tab="false">
<entry file="file://$PROJECT_DIR$/src/ctServer.java">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="272">
<caret line="40" column="25" selection-start-line="40" selection-start-column="25" selection-end-line="40" selection-end-column="25" />
<state relative-caret-position="485">
<caret line="32" column="1" selection-start-line="32" selection-start-column="1" selection-end-line="32" selection-end-column="1" />
<folding>
<element signature="imports" expanded="true" />
</folding>
@ -37,11 +37,11 @@
</provider>
</entry>
</file>
<file leaf-file-name="socketInfo.java" pinned="false" current-in-tab="false">
<entry file="file://$PROJECT_DIR$/src/socketInfo.java">
<file leaf-file-name="console.java" pinned="false" current-in-tab="false">
<entry file="file://$PROJECT_DIR$/src/console.java">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="-345">
<caret line="70" column="0" selection-start-line="70" selection-start-column="0" selection-end-line="70" selection-end-column="0" />
<state relative-caret-position="264">
<caret line="67" column="90" selection-start-line="67" selection-start-column="90" selection-end-line="67" selection-end-column="90" />
<folding>
<element signature="imports" expanded="true" />
</folding>
@ -49,11 +49,21 @@
</provider>
</entry>
</file>
<file leaf-file-name="socketInfo.java" pinned="false" current-in-tab="false">
<entry file="file://$PROJECT_DIR$/src/socketInfo.java">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="264">
<caret line="89" column="37" selection-start-line="89" selection-start-column="37" selection-end-line="89" selection-end-column="37" />
<folding />
</state>
</provider>
</entry>
</file>
<file leaf-file-name="client.java" pinned="false" current-in-tab="true">
<entry file="file://$PROJECT_DIR$/src/client.java">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="289">
<caret line="246" column="11" selection-start-line="243" selection-start-column="2" selection-end-line="246" selection-end-column="11" />
<state relative-caret-position="162">
<caret line="63" column="28" selection-start-line="63" selection-start-column="28" selection-end-line="63" selection-end-column="28" />
<folding>
<element signature="imports" expanded="true" />
</folding>
@ -61,14 +71,12 @@
</provider>
</entry>
</file>
<file leaf-file-name="console.java" pinned="false" current-in-tab="false">
<entry file="file://$PROJECT_DIR$/src/console.java">
<file leaf-file-name="JsonParser.class" pinned="false" current-in-tab="false">
<entry file="jar://$PROJECT_DIR$/lib/javax.json.jar!/javax/json/stream/JsonParser.class">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="-906">
<caret line="6" column="31" selection-start-line="6" selection-start-column="31" selection-end-line="6" selection-end-column="31" />
<folding>
<element signature="imports" expanded="true" />
</folding>
<state relative-caret-position="204">
<caret line="30" column="16" selection-start-line="30" selection-start-column="16" selection-end-line="30" selection-end-column="16" />
<folding />
</state>
</provider>
</entry>
@ -93,9 +101,9 @@
<list>
<option value="$PROJECT_DIR$/src/main.java" />
<option value="$PROJECT_DIR$/src/ctServer.java" />
<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/console.java" />
<option value="$PROJECT_DIR$/ctServer.iml" />
<option value="$PROJECT_DIR$/src/client.java" />
</list>
</option>
@ -137,7 +145,9 @@
<foldersAlwaysOnTop value="true" />
</navigator>
<panes>
<pane id="Scope" />
<pane id="Scratches" />
<pane id="PackagesPane" />
<pane id="ProjectPane">
<subPane>
<PATH>
@ -145,10 +155,6 @@
<option name="myItemId" value="ctServer" />
<option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.ProjectViewProjectNode" />
</PATH_ELEMENT>
<PATH_ELEMENT>
<option name="myItemId" value="External Libraries" />
<option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.ExternalLibrariesNode" />
</PATH_ELEMENT>
</PATH>
<PATH>
<PATH_ELEMENT>
@ -160,38 +166,8 @@
<option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.PsiDirectoryNode" />
</PATH_ELEMENT>
</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="src" />
<option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.PsiDirectoryNode" />
</PATH_ELEMENT>
</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>
</subPane>
</pane>
<pane id="PackagesPane" />
<pane id="Scope" />
</panes>
</component>
<component name="PropertiesComponent">
@ -683,45 +659,37 @@
<workItem from="1470739295224" duration="18435000" />
<workItem from="1470845742191" duration="18554000" />
<workItem from="1470936508138" duration="9814000" />
<workItem from="1470992276279" duration="57325000" />
<workItem from="1470992276279" duration="9337000" />
<workItem from="1471206887598" duration="5117000" />
</task>
<servers />
</component>
<component name="TimeTrackingManager">
<option name="totallyTimeSpent" value="135113000" />
</component>
<component name="TodoView">
<todo-panel id="selected-file">
<is-autoscroll-to-source value="true" />
</todo-panel>
<todo-panel id="all">
<are-packages-shown value="true" />
<is-autoscroll-to-source value="true" />
</todo-panel>
<option name="totallyTimeSpent" value="92242000" />
</component>
<component name="ToolWindowManager">
<frame x="-8" y="-8" width="1936" height="1066" extended-state="6" />
<editor active="true" />
<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="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.33" 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="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="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="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="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="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="Run" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="true" show_stripe_button="true" weight="0.36441585" sideWeight="0.45550162" order="2" 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="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="Project" active="false" anchor="left" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="true" show_stripe_button="true" weight="0.12846482" 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.0858209" 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="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="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="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="3" 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="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="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" />
@ -744,15 +712,7 @@
</component>
<component name="XDebuggerManager">
<breakpoint-manager>
<breakpoints>
<line-breakpoint enabled="true" type="java-line">
<url>file://$PROJECT_DIR$/src/client.java</url>
<line>53</line>
<properties />
<option name="timeStamp" value="41" />
</line-breakpoint>
</breakpoints>
<option name="time" value="42" />
<option name="time" value="33" />
</breakpoint-manager>
<watches-manager />
</component>
@ -761,6 +721,36 @@
<option name="FILTER_TARGETS" value="false" />
</component>
<component name="editorHistoryManager">
<entry file="file://$PROJECT_DIR$/src/ctServer.java">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="527">
<caret line="32" column="1" selection-start-line="32" selection-start-column="1" selection-end-line="32" selection-end-column="1" />
<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="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="867">
<caret line="62" column="9" selection-start-line="62" selection-start-column="9" selection-end-line="62" selection-end-column="9" />
<folding>
<element signature="imports" expanded="true" />
</folding>
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/src/ctServer.java">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="0">
@ -884,74 +874,46 @@
</provider>
</entry>
<entry file="jar://E:/ProfessionalPrograms/JDK8/src.zip!/java/lang/Thread.java" />
<entry file="file://$PROJECT_DIR$/.idea/copyright/profiles_settings.xml">
<entry file="file://$PROJECT_DIR$/ctServer.iml">
<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" />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/src/package-info.java" />
<entry file="jar://E:/ProfessionalPrograms/JDK8/src.zip!/java/lang/Thread.java" />
<entry file="jar://E:/ProfessionalPrograms/JDK8/src.zip!/java/util/ArrayList.java" />
<entry file="file://$PROJECT_DIR$/ctserver.xml" />
<entry file="file://$PROJECT_DIR$/module_ctserver.xml" />
<entry file="file://$PROJECT_DIR$/package-list" />
<entry file="jar://E:/ProfessionalPrograms/JDK8/src.zip!/java/net/SocketInputStream.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">
<state relative-caret-position="169">
<caret line="652" column="0" selection-start-line="652" selection-start-column="0" selection-end-line="652" selection-end-column="0" />
<folding />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/src/socketInfo.java___jb_tmp___">
<entry file="file://$PROJECT_DIR$/.idea/copyright/profiles_settings.xml">
<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 />
</state>
</provider>
</entry>
<entry file="jar://C:/Program Files/Java/jdk1.8.0_102/src.zip!/java/lang/Boolean.java">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="188">
<caret line="42" column="19" selection-start-line="42" selection-start-column="19" selection-end-line="42" selection-end-column="26" />
<folding />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/src/socketInfo.java">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="-345">
<caret line="70" column="0" selection-start-line="70" selection-start-column="0" selection-end-line="70" selection-end-column="0" />
<folding>
<element signature="imports" expanded="true" />
</folding>
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/src/package-info.java" />
<entry file="jar://E:/ProfessionalPrograms/JDK8/src.zip!/java/lang/Thread.java" />
<entry file="file://$PROJECT_DIR$/ctserver.properties">
<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 />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/ctServer.iml">
<entry file="jar://E:/ProfessionalPrograms/JDK8/src.zip!/java/util/ArrayList.java" />
<entry file="file://$PROJECT_DIR$/ctserver.xml" />
<entry file="file://$PROJECT_DIR$/module_ctserver.xml" />
<entry file="file://$PROJECT_DIR$/package-list" />
<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">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="170">
<caret line="10" column="12" selection-start-line="10" selection-start-column="12" selection-end-line="10" selection-end-column="12" />
<state relative-caret-position="204">
<caret line="30" column="16" selection-start-line="30" selection-start-column="16" selection-end-line="30" selection-end-column="16" />
<folding />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/src/ctServer.java">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="272">
<caret line="40" column="25" selection-start-line="40" selection-start-column="25" selection-end-line="40" selection-end-column="25" />
<state relative-caret-position="485">
<caret line="32" column="1" selection-start-line="32" selection-start-column="1" selection-end-line="32" selection-end-column="1" />
<folding>
<element signature="imports" expanded="true" />
</folding>
@ -960,18 +922,26 @@
</entry>
<entry file="file://$PROJECT_DIR$/src/console.java">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="-906">
<caret line="6" column="31" selection-start-line="6" selection-start-column="31" selection-end-line="6" selection-end-column="31" />
<state relative-caret-position="264">
<caret line="67" column="90" selection-start-line="67" selection-start-column="90" selection-end-line="67" selection-end-column="90" />
<folding>
<element signature="imports" expanded="true" />
</folding>
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/src/socketInfo.java">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="264">
<caret line="89" column="37" selection-start-line="89" selection-start-column="37" selection-end-line="89" selection-end-column="37" />
<folding />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/src/client.java">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="289">
<caret line="246" column="11" selection-start-line="243" selection-start-column="2" selection-end-line="246" selection-end-column="11" />
<state relative-caret-position="162">
<caret line="63" column="28" selection-start-line="63" selection-start-column="28" selection-end-line="63" selection-end-column="28" />
<folding>
<element signature="imports" expanded="true" />
</folding>

162
src/client.java

@ -1,5 +1,6 @@
import javax.json.Json;
import javax.json.JsonObject;
import javax.json.stream.JsonParser;
import javax.xml.bind.DatatypeConverter;
import java.io.*;
import java.net.*;
@ -18,58 +19,65 @@ public class client extends Thread {
private OutputStream out;
private InputStream in;
private Integer id;
private Boolean isClosing = false;
public void openSocket(Socket s) throws IOException {
socket = s;
out = socket.getOutputStream();
in = socket.getInputStream();
id = socketInfo.getNewID();
console.debug("Create new socket "+ id);
socketInfo.create(this,id);
console.debug("Create new socket " + id);
socketInfo.create(this, id);
start();
}
public void run() {
console.socket(id,"New connection");
console.socket(id, "New connection");
wsControl();
}
public void close(){
public void close() {
if(!socketInfo.isOnline(id)){
return;
}
try {
in.close();
out.close();
socket.close();
}catch (IOException e){
} catch (IOException e) {
}
console.socket(id,"Disconnected");
console.socket(id, "Disconnected");
socketInfo.close(id);
}
public void wsControl(){
public void wsControl() {
handshake();
if(!socketInfo.isHttpAuth(id)){
if (!socketInfo.isHttpAuth(id)) {
return;
}
while (socketInfo.isOnline(id)) {
String msg = readSocket();
parseInput(msg);
if(!socketInfo.isProtocolAuth(id)){socketInfo.checkProtocol(id);}
if(!socketInfo.isProtocolAuth(id)){sendSocket("{\"fn\":\"bad_protocol\"}");close();}
sendSocket(msg);
//TODO: сделать проверку протокола
}
}
private String bytesToStringUTFCustom(int[] ints) {
char[] buffer = new char[ints.length];
for(int i = 0; i < buffer.length; i++) {
for (int i = 0; i < buffer.length; i++) {
char c = (char) ints[i];
buffer[i] = c;
}
return new String(buffer);
}
private void handshake(){
try{
if(!socketInfo.isHttpAuth(id)) {
private void handshake() {
if(!socketInfo.isOnline(id)){close(); return;}
try {
if (!socketInfo.isHttpAuth(id)) {
socket.setSoTimeout(2000);
String data = new Scanner(in, "UTF-8").useDelimiter("\\r\\n\\r\\n").next();
Matcher get = Pattern.compile("^GET").matcher(data);
@ -97,52 +105,54 @@ public class client extends Thread {
}
socket.setSoTimeout(0);
socketInfo.setHttpAuth(id, true);
console.socket(id,"Handshake accepted!");
console.socket(id, "Handshake accepted!");
}
}
}catch (SocketException e){
} catch (SocketException e) {
console.debug("исключение 22");
//TODO: написать исключение если сокет закрыт
}catch (NoSuchElementException e){
console.socket(id,"Handshake Timeout (2000ms)");
} catch (NoSuchElementException e) {
console.socket(id, "Handshake Timeout (2000ms)");
socketInfo.setHttpAuth(id, false);
close();
} catch(IllegalStateException e){
console.socket(id, "Bad handshake request!");
close();
}
}
public Boolean sendSocket(String message){
public Boolean sendSocket(String message) {
if(!socketInfo.isOnline(id)){close(); return false;}
byte[] response;
byte[] r;
try{
try {
response = message.getBytes("UTF-8");
}catch (UnsupportedEncodingException e){
} catch (UnsupportedEncodingException e) {
console.socket(id, "Unsupported encoding!");
return false;
}
catch (NullPointerException e){
} catch (NullPointerException e) {
return false;
}
if (message.length() < 126) {
r = new byte[response.length+2];
System.arraycopy(response,0,r,2,response.length);
r = new byte[response.length + 2];
System.arraycopy(response, 0, r, 2, response.length);
r[0] = (byte) 129;
r[1] = (byte) (response.length);
}
else{
} else {
if (message.length() < 65535) {
r = new byte[response.length+4];
System.arraycopy(response,0,r,4,response.length);
r = new byte[response.length + 4];
System.arraycopy(response, 0, r, 4, response.length);
r[0] = (byte) 129;
r[1] = (byte) 126;
r[2] = (byte) (response.length >>> 8);
r[3] = (byte) (response.length);
}
else{
if(response.length > Long.MAX_VALUE){
} else {
if (response.length > Long.MAX_VALUE) {
console.out("Socket Exception", "Too long message for sending! (>64bit)");
return false;
}
r = new byte[response.length+8];
System.arraycopy(response,0,r,8,response.length);
r = new byte[response.length + 8];
System.arraycopy(response, 0, r, 8, response.length);
r[0] = (byte) 129;
r[1] = (byte) 127;
r[2] = (byte) (response.length >>> 56);
@ -155,42 +165,48 @@ public class client extends Thread {
r[9] = (byte) (response.length);
}
}
try{
try {
out.write(r, 0, r.length);
return true;
}catch(IOException e){
} catch (IOException e) {
console.out("Socket Exeption", "Client socket is closed?! Closing socket connection!");
close();
return false;
}
}
public String readSocket(){
public String readSocket() {
if(!socketInfo.isOnline(id)){close(); return null;}
String out = "";
try
{
try {
int[] MSG = new int[0];
int OPCOUNT = 1;
int LENGTH;
int KEYFRAME = 0;
int[] KEY = new int[4];
int OPCODE = in.read(); //читаем OPCODE byte
switch(OPCODE){
case -1: close(); //закрываем чтение потока при -1
switch (OPCODE) {
case -1:
close(); //закрываем чтение потока при -1
return null;
case 136: close();
case 136:
close();
return null;
case 129:
LENGTH = in.read(); //читаем второй бит с данными о размере сообщения
//TODO: which и switch OPCOUNT - необходимо убрать
while(OPCOUNT < 4) {
switch (OPCOUNT){
case 1: switch (LENGTH){ //узнаем длину сообщения
default: KEYFRAME = 2;
while (OPCOUNT < 4) {
switch (OPCOUNT) {
case 1:
switch (LENGTH) { //узнаем длину сообщения
default:
KEYFRAME = 2;
break;
case 254: KEYFRAME = 4; //126-65535
case 254:
KEYFRAME = 4; //126-65535
break;
case 255: KEYFRAME = 10; //65535-...
case 255:
KEYFRAME = 10; //65535-...
break;
}
break;
@ -224,27 +240,60 @@ public class client extends Thread {
}
break;
case 3:
if(MSG.length>0){
if (MSG.length > 0) {
out = bytesToStringUTFCustom(MSG);
}
else{
} else {
return null;
}
}
OPCOUNT++;
}
}
}catch(IOException e){
} catch (IOException e) {
console.out("Socket Exception", "Client socket is closed?! Closing socket connection!");
close();
}
console.socket(id, "Message: "+out);
if(!socketInfo.isOnline(id)){close(); return null;}
console.socket(id, "Message: " + out);
return out;
}
//
// public static Boolean checkProtocol(String input){
// JsonObject first = Json.createParser(new StringReader(input)).getStrint;
// }
public Boolean parseInput(String input) {
if(!socketInfo.isOnline(id)){close();return false;}
try {
String keyName = null;
JsonParser jsonParser = Json.createParser(new StringReader(input));
while (jsonParser.hasNext()) {
JsonParser.Event event = jsonParser.next();
switch (event) {
case KEY_NAME:
keyName = jsonParser.getString();
break;
case VALUE_STRING:
socketInfo.setString(id, keyName, jsonParser.getString());
break;
case VALUE_NUMBER:
socketInfo.setInteger(id, keyName, jsonParser.getInt());
break;
case VALUE_FALSE:
break;
case VALUE_TRUE:
break;
case VALUE_NULL:
// don't set anything
break;
default:
// we are not looking for other events
break;
}
}
return true;
}catch(NullPointerException e){
console.socket(id,"Request parsing error!");
return false;
}
}
}
// public void sControl(){
// try{
@ -283,4 +332,3 @@ public class client extends Thread {
// }
// }
}

30
src/console.java

@ -21,13 +21,23 @@ public class console extends Thread{
}
public static void out(String parent, String msg){
String time = Clock.systemUTC().instant().toString();
System.out.println("["+time+"|"+parent+"]: "+msg);
String out = "[";
out += Clock.systemUTC().instant().toString();
out += "|";
out += parent;
out += "]: ";
out += msg;
System.out.println(out);
}
public static void socket(Integer socketId, String msg){
String time = Clock.systemUTC().instant().toString();
System.out.println("["+time+"|"+"Socket "+socketId+"]: "+msg);
String out = "[";
out += Clock.systemUTC().instant().toString();
out += "|Socket ";
out += socketId;
out += "]: ";
out += msg;
System.out.println(out);
}
public static void debug(String msg){
@ -49,11 +59,15 @@ public class console extends Thread{
case "/list":
console.out("Server","/list");
for(int i = 0; socketInfo.SOCKETID.size() > i; i++){
int id = socketInfo.SOCKETID.get(i);
if(socketInfo.isProtocolAuth(id)) {
console.socket(id,"VKID " + socketInfo.VKID.get(id) + " and PROTOCOL " + socketInfo.PROTOCOL.get(id));
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(id,"Protocol not checked!");
console.socket(sid,"Protocol not checked!");
}
}
break;

42
src/ctServer.java

@ -1,49 +1,7 @@
import java.net.*;
import java.io.*;
import java.util.ArrayList;
import java.util.List;
import java.util.regex.Pattern;
public class ctServer {
// public static int socketID;
// public static ArrayList<socketInfo> socketInfoList;
public static boolean checkClient(socketInfo socketID, String[] args){
/*
socketInfo flow = new socketInfo();
//TODO: Устарело
//TODO: перенести в console.java
try {
for (String name : args) {
Pattern main = Pattern.compile(":");
String[] sx = main.split(name);
switch (sx[0]) {
case "PROTOCOL":
flow.PROTOCOL = sx[1];
break;
case "VKID":
flow.VKID = sx[1];
break;
}
}
if (!flow.VKID.equals("")) {
if (!flow.PROTOCOL.equals("")) {
flow.httpAuth = true;
socketInfoList.set(flow.SOCKETID, flow);
console.debug("Авторизация произошла!");
return true;
}
}
} catch (NullPointerException e){
return false;
}finally {
flow.close();
System.gc();
}
*/
return false;
}
public static void main(String[] args) throws IOException{
socketInfo.init();

41
src/socketInfo.java

@ -6,7 +6,7 @@ import java.util.function.BooleanSupplier;
*/
public class socketInfo {
public static ArrayList<String> ROLE, PROTOCOL, EVENT, TRACKID;
public static ArrayList<Integer> VKID, TIME, SOCKETID, PARTYID;
public static ArrayList<Integer> VKID, TIME, SOCKETID, PARTYID, DURATION;
public static ArrayList<Boolean> ONLINE, httpAuth, protocolAuth;
public static ArrayList<client> CLIENT;
public static Integer sid;
@ -22,6 +22,7 @@ public class socketInfo {
PARTYID = new ArrayList<>();
TRACKID = new ArrayList<>();
PROTOCOL = new ArrayList<>();
DURATION = new ArrayList<>();
SOCKETID = new ArrayList<>();
ONLINE = new ArrayList<>();
httpAuth = new ArrayList<>();
@ -38,6 +39,7 @@ public class socketInfo {
TRACKID.add("");
PROTOCOL.add("");
PARTYID.add(0);
DURATION.add(0);
SOCKETID.add(sid);
httpAuth.add(false);
protocolAuth.add(false);
@ -52,6 +54,7 @@ public class socketInfo {
TRACKID.remove(s);
SOCKETID.remove(s);
TIME.remove(s);
DURATION.remove(s);
PARTYID.remove(s);
CLIENT.remove(s);
ONLINE.remove(s);
@ -81,13 +84,12 @@ public class socketInfo {
httpAuth.set(s, b);
}
public static void setProtocol(Integer sid, Integer vkid, Integer pid, String role){
public static void checkProtocol(Integer sid){
int s = findSocket(sid);
if(s == -1) return;
if(PROTOCOL.get(s).equals("1A")){
protocolAuth.set(s, true);
VKID.set(s, vkid);
PARTYID.set(s, pid);
ROLE.set(s, role);
}
}
public static Boolean isProtocolAuth(Integer sid){
@ -114,5 +116,34 @@ public class socketInfo {
return socketInfo.CLIENT.get(s);
}
public static void setString(Integer sid, String keyName, String value) {
int s = findSocket(sid);
if (s == -1) return;
switch (keyName) {
case "fn":
EVENT.set(s, value);
break;
case "tI":
TRACKID.set(s, value);
break;
case "protocol":
PROTOCOL.set(s, value);
break;
}
}
public static void setInteger(Integer sid, String keyName, Integer value){
int s = findSocket(sid);
if(s == -1) return;
switch (keyName){
case "vk_id": VKID.set(s, value);
break;
case "tT": TIME.set(s, value);
break;
case "partyId": PARTYID.set(s, value);
break;
case "tD": DURATION.set(s, value);
break;
}
}
}

Loading…
Cancel
Save