Browse Source

Release 28

master
Defend 8 years ago
parent
commit
2141837ed1
  1. 1050
      .idea/workspace (1).xml
  2. 676
      .idea/workspace.xml
  3. 17
      src/Protocol.java
  4. 151
      src/SocketMaps.java
  5. 228
      src/client.java
  6. 103
      src/console.java
  7. 8
      src/ctException.java
  8. 18
      src/ctServer.java
  9. 171
      src/eventHandler.java
  10. 188
      src/socketInfo.java

1050
.idea/workspace (1).xml

File diff suppressed because it is too large

676
.idea/workspace.xml

@ -1,5 +1,8 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="BookmarkManager">
<bookmark url="uml://JAVA/" />
</component>
<component name="ChangeListManager">
<list default="true" id="ef1cf760-9407-4380-a84e-9b438e35c16c" name="Default" comment="" />
<ignored path="ctServer.iws" />
@ -14,6 +17,7 @@
<option name="LAST_RESOLUTION" value="IGNORE" />
</component>
<component name="CoverageDataManager">
<SUITE FILE_PATH="coverage/ctServer$Debug.coverage" NAME="Debug Coverage Results" MODIFIED="1473774241735" SOURCE_PROVIDER="com.intellij.coverage.DefaultCoverageFileProvider" RUNNER="idea" COVERAGE_BY_TEST_ENABLED="false" COVERAGE_TRACING_ENABLED="false" />
<SUITE FILE_PATH="coverage/ctServer$Unnamed.coverage" NAME="Unnamed Coverage Results" MODIFIED="1470865818918" SOURCE_PROVIDER="com.intellij.coverage.DefaultCoverageFileProvider" RUNNER="idea" COVERAGE_BY_TEST_ENABLED="false" COVERAGE_TRACING_ENABLED="false" />
</component>
<component name="CreatePatchCommitExecutor">
@ -24,85 +28,72 @@
<favorites_list name="ctServer" />
</component>
<component name="FileEditorManager">
<splitter split-orientation="horizontal" split-proportion="0.5">
<split-first>
<leaf SIDE_TABS_SIZE_LIMIT_KEY="300">
<file leaf-file-name="ctServer.java" pinned="false" current-in-tab="false">
<entry file="file://$PROJECT_DIR$/src/ctServer.java">
<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="102">
<caret line="6" column="26" selection-start-line="6" selection-start-column="26" selection-end-line="6" selection-end-column="26" />
<folding>
<element signature="imports" expanded="true" />
</folding>
<state relative-caret-position="238">
<caret line="15" column="58" selection-start-line="15" selection-start-column="58" selection-end-line="15" selection-end-column="58" />
<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">
<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="17">
<caret line="3" column="23" selection-start-line="3" selection-start-column="23" selection-end-line="3" selection-end-column="23" />
<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 relative-caret-position="688">
<caret line="76" column="19" selection-start-line="76" selection-start-column="19" selection-end-line="76" selection-end-column="19" />
<folding />
</state>
</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="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="530">
<caret line="182" column="24" selection-start-line="182" selection-start-column="24" selection-end-line="182" selection-end-column="24" />
<folding>
<element signature="imports" expanded="true" />
</folding>
<state relative-caret-position="1955">
<caret line="128" column="5" selection-start-line="128" selection-start-column="5" selection-end-line="128" selection-end-column="5" />
<folding />
</state>
</provider>
</entry>
</file>
<file leaf-file-name="client.java" pinned="false" current-in-tab="false">
<entry file="file://$PROJECT_DIR$/src/client.java">
<file leaf-file-name="EventHandler.java" pinned="false" current-in-tab="false">
<entry file="file://$PROJECT_DIR$/src/EventHandler.java">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="340">
<caret line="279" column="69" selection-start-line="279" selection-start-column="69" selection-end-line="279" selection-end-column="69" />
<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 relative-caret-position="289">
<caret line="21" column="39" selection-start-line="21" selection-start-column="39" selection-end-line="21" selection-end-column="39" />
<folding />
</state>
</provider>
</entry>
</file>
<file leaf-file-name="eventHandler.java" pinned="false" current-in-tab="false">
<entry file="file://$PROJECT_DIR$/src/eventHandler.java">
</leaf>
</split-first>
<split-second>
<leaf SIDE_TABS_SIZE_LIMIT_KEY="300">
<file leaf-file-name="CtServer.java" pinned="false" current-in-tab="true">
<entry file="file://$PROJECT_DIR$/src/CtServer.java">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="530">
<caret line="152" column="36" selection-start-line="152" selection-start-column="36" selection-end-line="152" selection-end-column="36" />
<folding>
<element signature="imports" expanded="true" />
<element signature="method#close#0;class#eventHandler#0" expanded="false" />
</folding>
<state relative-caret-position="238">
<caret line="15" column="58" selection-start-line="15" selection-start-column="58" selection-end-line="15" selection-end-column="58" />
<folding />
</state>
</provider>
</entry>
</file>
</leaf>
</split-second>
</splitter>
</component>
<component name="FileTemplateManagerImpl">
<option name="RECENT_TEMPLATES">
<list>
<option value="package-info" />
<option value="Enum" />
<option value="Class" />
</list>
</option>
@ -117,11 +108,26 @@
<list>
<option value="$PROJECT_DIR$/src/main.java" />
<option value="$PROJECT_DIR$/lib/javax.json.jar!/javax/json/stream/JsonParser.class" />
<option value="$PROJECT_DIR$/src/eventNames.java" />
<option value="$PROJECT_DIR$/src/regControl.java" />
<option value="$PROJECT_DIR$/src/socketEye.java" />
<option value="$PROJECT_DIR$/src/sEye.java" />
<option value="$PROJECT_DIR$/src/protocol.java" />
<option value="$PROJECT_DIR$/src/ctServer.java" />
<option value="$PROJECT_DIR$/src/console.java" />
<option value="$PROJECT_DIR$/src/socketInfo.java" />
<option value="$PROJECT_DIR$/src/client.java" />
<option value="$PROJECT_DIR$/src/Protocol.java" />
<option value="$PROJECT_DIR$/src/eventHandler.java" />
<option value="$PROJECT_DIR$/src/ctServer.java" />
<option value="$PROJECT_DIR$/src/console.java" />
<option value="$PROJECT_DIR$/src/clientException.java" />
<option value="$PROJECT_DIR$/src/Events.java" />
<option value="$PROJECT_DIR$/src/ctException.java" />
<option value="$PROJECT_DIR$/src/Console.java" />
<option value="$PROJECT_DIR$/src/EventHandler.java" />
<option value="$PROJECT_DIR$/src/Client.java" />
<option value="$PROJECT_DIR$/src/SocketMaps.java" />
<option value="$PROJECT_DIR$/src/SocketInfo.java" />
<option value="$PROJECT_DIR$/src/CtServer.java" />
</list>
</option>
</component>
@ -134,8 +140,8 @@
<component name="ProjectFrameBounds">
<option name="x" value="-8" />
<option name="y" value="-8" />
<option name="width" value="1936" />
<option name="height" value="1066" />
<option name="width" value="1456" />
<option name="height" value="886" />
</component>
<component name="ProjectLevelVcsManager" settingsEditedManually="false">
<OptionsSetting value="true" id="Add" />
@ -162,7 +168,6 @@
<foldersAlwaysOnTop value="true" />
</navigator>
<panes>
<pane id="PackagesPane" />
<pane id="Scratches" />
<pane id="Scope" />
<pane id="ProjectPane">
@ -197,40 +202,9 @@
<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_ELEMENT>
<option name="myItemId" value="javax.json.jar" />
<option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.PsiFileNode" />
</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" />
</panes>
</component>
<component name="PropertiesComponent">
@ -243,9 +217,13 @@
<property name="GenerateAntBuildDialog.backupFiles" value="true" />
<property name="GenerateAntBuildDialog.outputFileNameProperty" value="ctserver" />
<property name="last_opened_file_path" value="$PROJECT_DIR$" />
<property name="extract.method.default.visibility" value="private" />
<property name="restartRequiresConfirmation" value="false" />
</component>
<component name="RecentsManager">
<key name="ExtractSuperBase.RECENT_KEYS">
<recent name="" />
</key>
</component>
<component name="RunManager" selected="Application.Debug">
<configuration default="true" type="#com.intellij.j2meplugin.run.J2MEConfigurationType" factoryName="J2ME">
<module name="" />
@ -690,7 +668,7 @@
</configuration>
<configuration default="false" name="Debug" type="Application" factoryName="Application" singleton="true">
<extension name="coverage" enabled="false" merge="false" sample_coverage="true" runner="idea" />
<option name="MAIN_CLASS_NAME" value="ctServer" />
<option name="MAIN_CLASS_NAME" value="CtServer" />
<option name="VM_PARAMETERS" value="" />
<option name="PROGRAM_PARAMETERS" value="" />
<option name="WORKING_DIRECTORY" value="file://$PROJECT_DIR$" />
@ -728,12 +706,22 @@
<workItem from="1471206887598" duration="5117000" />
<workItem from="1471213151749" duration="371000" />
<workItem from="1471272205780" duration="2459000" />
<workItem from="1471346121020" duration="38313000" />
<workItem from="1471346121020" duration="1145000" />
<workItem from="1473182381347" duration="4229000" />
<workItem from="1473440904946" duration="7868000" />
<workItem from="1473452237192" duration="2428000" />
<workItem from="1473537243622" duration="15311000" />
<workItem from="1473581346038" duration="40972000" />
<workItem from="1474184585685" duration="597000" />
<workItem from="1474185668428" duration="755000" />
<workItem from="1474466481625" duration="2072000" />
<workItem from="1478531241458" duration="1197000" />
<workItem from="1478536975212" duration="14000" />
</task>
<servers />
</component>
<component name="TimeTrackingManager">
<option name="totallyTimeSpent" value="133385000" />
<option name="totallyTimeSpent" value="173143000" />
</component>
<component name="TodoView">
<todo-panel id="selected-file">
@ -745,36 +733,64 @@
</todo-panel>
</component>
<component name="ToolWindowManager">
<frame x="-8" y="-8" width="1936" height="1066" extended-state="6" />
<frame x="-8" y="-8" width="1456" height="886" 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.3290461" sideWeight="0.5" order="6" 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="TODO" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.32827735" sideWeight="0.5" order="6" 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.3869239" sideWeight="0.5042644" order="8" 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.32756758" sideWeight="0.50426894" 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="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.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.3279743" sideWeight="0.49573562" order="10" 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="false" show_stripe_button="true" weight="0.38325992" sideWeight="0.45550162" order="2" side_tool="false" content_ui="tabs" />
<window_info id="Terminal" active="true" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="true" show_stripe_button="true" weight="0.26958832" sideWeight="0.49573106" 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.08315565" 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.103151865" 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="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="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="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="Debug" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.39838493" sideWeight="0.47708333" order="3" 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="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" />
<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="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="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="Messages" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.4064603" sideWeight="0.4792111" order="7" 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="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.32904884" 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.3270525" sideWeight="0.5" order="1" side_tool="false" content_ui="tabs" />
</layout>
<layout-to-restore>
<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="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" />
<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="Event Log" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.32756758" sideWeight="0.50426894" 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="4" 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="5" 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="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="6" 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="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="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.32792208" sideWeight="0.4792111" order="8" 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="4" 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="7" 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="5" 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.38528138" 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="9" 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="8" side_tool="true" 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.32756758" sideWeight="0.49573106" order="10" 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.090618335" sideWeight="0.5" order="0" side_tool="false" content_ui="combo" />
<window_info id="Find" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.32864866" sideWeight="0.5" order="1" 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="5" side_tool="true" content_ui="tabs" />
</layout-to-restore>
</component>
<component name="Vcs.Log.UiProperties">
<option name="RECENTLY_FILTERED_USER_GROUPS">
@ -789,181 +805,52 @@
</component>
<component name="XDebuggerManager">
<breakpoint-manager>
<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" />
<option name="time" value="72" />
</breakpoint-manager>
<watches-manager />
<watches-manager>
<configuration name="Application">
<watch expression="SocketMaps.getInfo(socketid).PROTOCOL" language="JAVA" />
<watch expression="SocketMaps.getCreator(120616799)" language="JAVA" />
<watch expression="SocketMaps.creator.size()" language="JAVA" />
<watch expression="SocketMaps.creator.keySet()" language="JAVA" />
<watch expression="SocketMaps.getPID(0)" language="JAVA" />
</configuration>
</watches-manager>
</component>
<component name="antWorkspaceConfiguration">
<option name="IS_AUTOSCROLL_TO_SOURCE" value="false" />
<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="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">
<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="1037">
<caret line="67" column="90" selection-start-line="67" selection-start-column="90" selection-end-line="67" selection-end-column="90" />
<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="1496">
<caret line="89" column="37" selection-start-line="89" selection-start-column="37" selection-end-line="89" selection-end-column="37" />
<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="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" />
<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="jar://$PROJECT_DIR$/lib/javax.json.jar!/javax/json/stream/JsonParser.class">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="425">
<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">
<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>
<folding />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/src/console.java">
<entry file="file://$PROJECT_DIR$/src/Console.java">
<provider selected="true" editor-type-id="text-editor">
<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" />
<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="1496">
<caret line="89" column="37" selection-start-line="89" selection-start-column="37" selection-end-line="89" selection-end-column="37" />
<folding>
<element signature="imports" expanded="true" />
</folding>
<folding />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/src/client.java">
<entry file="file://$PROJECT_DIR$/src/SocketInfo.java" />
<entry file="file://$PROJECT_DIR$/src/Client.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" />
<element signature="method#bytesToStringUTFCustom#0;class#client#0" expanded="false" />
<element signature="method#handshake#0;class#client#0" expanded="false" />
</folding>
<folding />
</state>
</provider>
</entry>
@ -971,214 +858,128 @@
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="425">
<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">
<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>
<folding />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/src/console.java">
<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="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>
<folding />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/src/client.java">
<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" />
<element signature="method#bytesToStringUTFCustom#0;class#client#0" expanded="false" />
<element signature="method#handshake#0;class#client#0" expanded="false" />
</folding>
<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">
<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>
<folding />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/src/console.java">
<entry file="file://$PROJECT_DIR$/src/Console.java">
<provider selected="true" editor-type-id="text-editor">
<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" />
<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>
<folding />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/src/client.java">
<entry file="file://$PROJECT_DIR$/src/Client.java">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="918">
<caret line="54" column="20" selection-start-line="54" selection-start-column="20" selection-end-line="54" selection-end-column="20" />
<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>
<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">
<state relative-caret-position="221">
<caret line="13" column="47" selection-start-line="13" selection-start-column="47" selection-end-line="13" selection-end-column="47" />
<folding>
<element signature="imports" expanded="true" />
</folding>
<folding />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/src/console.java">
<entry file="file://$PROJECT_DIR$/src/Console.java">
<provider selected="true" editor-type-id="text-editor">
<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" />
<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>
<folding />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/src/client.java">
<entry file="file://$PROJECT_DIR$/src/Client.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" />
<element signature="method#bytesToStringUTFCustom#0;class#client#0" expanded="false" />
<element signature="method#handshake#0;class#client#0" expanded="false" />
</folding>
<folding />
</state>
</provider>
</entry>
<entry file="jar://E:/ProfessionalPrograms/JDK8/src.zip!/java/lang/Thread.java" />
<entry file="file://$PROJECT_DIR$/src/ctServer.java">
<entry file="file://$PROJECT_DIR$/src/CtServer.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>
<folding />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/src/console.java">
<entry file="file://$PROJECT_DIR$/src/Console.java">
<provider selected="true" editor-type-id="text-editor">
<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" />
<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>
<folding />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/src/client.java">
<entry file="file://$PROJECT_DIR$/src/Client.java">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="1343">
<caret line="86" column="50" selection-start-line="86" selection-start-column="50" selection-end-line="86" selection-end-column="50" />
<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>
<folding />
</state>
</provider>
</entry>
<entry file="jar://E:/ProfessionalPrograms/JDK8/src.zip!/java/lang/Thread.java" />
<entry file="file://$PROJECT_DIR$/src/ctServer.java">
<entry file="file://$PROJECT_DIR$/src/CtServer.java">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="221">
<caret line="13" column="37" selection-start-line="13" selection-start-column="37" selection-end-line="13" selection-end-column="37" />
<folding>
<element signature="imports" expanded="true" />
</folding>
<folding />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/src/console.java">
<entry file="file://$PROJECT_DIR$/src/Console.java">
<provider selected="true" editor-type-id="text-editor">
<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" />
<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>
<folding />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/src/client.java">
<entry file="file://$PROJECT_DIR$/src/Client.java">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="731">
<caret line="43" column="30" selection-start-line="43" selection-start-column="30" selection-end-line="43" selection-end-column="30" />
<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>
<folding />
</state>
</provider>
</entry>
@ -1211,81 +1012,126 @@
<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="374">
<caret line="22" column="19" selection-start-line="22" selection-start-column="19" selection-end-line="22" selection-end-column="19" />
<folding />
<entry file="uml://JAVA/socketInfo">
<provider selected="true" editor-type-id="UmlEditorProvider">
<state>
<ID>JAVA</ID>
<OriginalElement>socketInfo</OriginalElement>
<nodes>
<node x="-398.0" y="-311.0">socketInfo</node>
<node x="569.75" y="313.75">socketInfo.findSocket</node>
</nodes>
<notes />
<edges>
<edge source="socketInfo.findSocket" target="socketInfo">
<point x="-47.0" y="-36.5" />
<point x="345.5" y="715.0" />
<point x="196.25" y="715.0" />
<point x="-196.25" y="345.0" />
</edge>
</edges>
<settings layout="Hierarchic Group" zoom="0.8" x="-562.0" y="73.0" />
<SelectedNodes>
<node>socketInfo</node>
</SelectedNodes>
<Categories>
<Category>Fields</Category>
<Category>Inner Classes</Category>
<Category>Constructors</Category>
<Category>Properties</Category>
<Category>Methods</Category>
</Categories>
<SCOPE>All</SCOPE>
<VISIBILITY>private</VISIBILITY>
</state>
</provider>
</entry>
<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="185">
<caret line="430" column="0" selection-start-line="430" selection-start-column="0" selection-end-line="430" selection-end-column="0" />
<folding />
<entry file="uml://JAVA/">
<provider selected="true" editor-type-id="UmlEditorProvider">
<state>
<ID>JAVA</ID>
<OriginalElement />
<nodes>
<node x="" y="">com</node>
<node x="" y="">console</node>
<node x="" y="">netscape</node>
<node x="" y="">oracle</node>
<node x="" y="">org</node>
<node x="" y="">sun</node>
<node x="" y="">META-INF</node>
<node x="" y="">jdk</node>
<node x="" y="">java</node>
<node x="" y="">javax</node>
<node x="" y="">socketInfo.findSocket</node>
<node x="" y="">client</node>
<node x="" y="">socketInfo</node>
<node x="" y="">eventNames</node>
<node x="" y="">ctServer</node>
<node x="" y="">javafx</node>
<node x="" y="">eventHandler</node>
</nodes>
<notes />
<edges />
<settings layout="Hierarchic Group" zoom="0.6262626262626263" x="672.0" y="683.0" />
<SelectedNodes />
<Categories>
<Category>Fields</Category>
<Category>Inner Classes</Category>
<Category>Constructors</Category>
<Category>Properties</Category>
<Category>Methods</Category>
</Categories>
<SCOPE>All</SCOPE>
<VISIBILITY>private</VISIBILITY>
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/src/eventHandler.java">
<entry file="file://$PROJECT_DIR$/src/newInfo.java" />
<entry file="jar://C:/Program Files/Java/jdk1.8.0_102/src.zip!/java/util/ArrayList.java" />
<entry file="file://$PROJECT_DIR$/src/eventNames.java" />
<entry file="file://$PROJECT_DIR$/src/sEye.java" />
<entry file="file://$PROJECT_DIR$/src/Protocol.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="530">
<caret line="152" column="36" selection-start-line="152" selection-start-column="36" selection-end-line="152" selection-end-column="36" />
<folding>
<element signature="imports" expanded="true" />
<element signature="method#close#0;class#eventHandler#0" expanded="false" />
</folding>
<state relative-caret-position="493">
<caret line="34" column="8" selection-start-line="34" selection-start-column="8" selection-end-line="34" selection-end-column="8" />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/src/client.java">
<entry file="file://$PROJECT_DIR$/src/clientException.java" />
<entry file="file://$PROJECT_DIR$/src/Events.java" />
<entry file="file://$PROJECT_DIR$/src/ctException.java" />
<entry file="file://$PROJECT_DIR$/src/SocketMaps.java" />
<entry file="file://$PROJECT_DIR$/src/EventHandler.java">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="340">
<caret line="279" column="69" selection-start-line="279" selection-start-column="69" selection-end-line="279" selection-end-column="69" />
<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 relative-caret-position="289">
<caret line="21" column="39" selection-start-line="21" selection-start-column="39" selection-end-line="21" selection-end-column="39" />
<folding />
</state>
</provider>
</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">
<state relative-caret-position="530">
<caret line="182" column="24" selection-start-line="182" selection-start-column="24" selection-end-line="182" selection-end-column="24" />
<folding>
<element signature="imports" expanded="true" />
</folding>
<state relative-caret-position="1955">
<caret line="128" column="5" selection-start-line="128" selection-start-column="5" selection-end-line="128" selection-end-column="5" />
<folding />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/src/ctServer.java">
<entry file="file://$PROJECT_DIR$/src/Console.java">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="102">
<caret line="6" column="26" selection-start-line="6" selection-start-column="26" selection-end-line="6" selection-end-column="26" />
<folding>
<element signature="imports" expanded="true" />
</folding>
<state relative-caret-position="688">
<caret line="76" column="19" selection-start-line="76" selection-start-column="19" selection-end-line="76" selection-end-column="19" />
<folding />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/src/console.java">
<entry file="file://$PROJECT_DIR$/src/SocketInfo.java" />
<entry file="file://$PROJECT_DIR$/src/CtServer.java">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="17">
<caret line="3" column="23" selection-start-line="3" selection-start-column="23" selection-end-line="3" selection-end-column="23" />
<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 relative-caret-position="238">
<caret line="15" column="58" selection-start-line="15" selection-start-column="58" selection-end-line="15" selection-end-column="58" />
<folding />
</state>
</provider>
</entry>

17
src/Protocol.java

@ -0,0 +1,17 @@
/**
* Created by itsmy on 11.09.2016.
*/
public class Protocol {
static class _1A{
final static String EVENT = "EVENT";
final static String TIME = "TIME";
final static String AID = "AID";
final static String PLAYLIST = "PLAYLIST";
final static String TRACKTIME = "TRACKTIME";
final static String DURATION = "DURATION";
final static String AP = "AP";
final static String PS = "PS";
final static String ROLE = "ROLE";
final static String ONLINE = "ONLINE";
}
}

151
src/SocketMaps.java

@ -0,0 +1,151 @@
import java.util.ArrayList;
import java.util.HashMap;
import java.util.Map;
import java.util.Set;
/**
* Created by itsmy_000 on 12.09.2016.
*/
public class SocketMaps{
public enum Events{
CREATING, PLAY, PAUSE, REWIND, DISCONNECT
}
public enum Roles{
CREATOR, LISTNER
}
public enum Keys{
SOCKETID, PARTYID, EVENT, ROLE, CREATOR, CLIENT
}
private static Map<Integer, Client> SID;
private static Map<Integer, Integer> PID;
private static Map<Integer, Events> EID;
private static Map<Integer, Client.Info> info;
private static Map<Integer, Roles> role;
private static Map<Integer, Integer> creator; // 1 - SID, 2 - PID
private static Integer counter;
static void initMaps(){
counter = 0;
SID = new HashMap<>();
PID = new HashMap<>();
EID = new HashMap<>();
info = new HashMap<>();
role = new HashMap<>();
creator = new HashMap<>();
}
static Integer addClient(Client c, Client.Info i){
SID.put(counter, c);
info.put(counter, i);
PID.put(counter,null);
EID.put(counter,Events.CREATING);
return counter++;
}
static void removeClient(Integer socketid) throws ctException{
containSID(socketid);
Integer partyid = getPID(socketid);
if(getCreator(partyid) == socketid){
creator.remove(partyid);
}
SID.remove(socketid);
PID.remove(socketid);
EID.remove(socketid);
role.remove(socketid);
info.remove(socketid);
}
static void setPID(Integer socketid, Integer partyid) throws ctException{
containSID(socketid);
PID.put(socketid,partyid);
}
static void setEID(Integer socketid, Events event) throws ctException {
containSID(socketid);
EID.put(socketid, event);
}
static void setRole(Integer socketid, Roles r) throws ctException {
containSID(socketid);
role.put(socketid, r);
}
static void setCreator(Integer partyid, Integer creatorsid){
if(!creator.containsKey(partyid)) {
creator.put(partyid,creatorsid);
}
}
static Client getClient(Integer socketid) throws ctException{
containSID(socketid);
return SID.get(socketid);
}
static Client.Info getInfo(Integer socketid) throws ctException{
containSID(socketid);
return info.get(socketid);
}
static Integer getPID(Integer socketid) throws ctException {
containSID(socketid);
return PID.get(socketid);
}
static Roles getRole(Integer socketid) throws ctException {
containSID(socketid);
return role.get(socketid);
}
static Events getEID(Integer socketid) throws ctException {
containSID(socketid);
return EID.get(socketid);
}
static ArrayList<Integer> getAllClients(){
ArrayList<Integer> list = new ArrayList<>();
for (Integer integer : SID.keySet()) {
list.add(integer);
}
return list;
}
static ArrayList<Integer> getAllParty(Integer partyid){
ArrayList<Integer> list = new ArrayList<>();
Console.debug("Enter to getAllParty()");
for (int i = 0; i < PID.size(); i++) {
Map.Entry<Integer, Integer> temp = PID.entrySet().iterator().next();
if(temp.getValue() == partyid) {
list.add(temp.getKey());
Console.debug("getAllParty()|"+temp.getKey()+"|"+temp.getValue());
}
}
return list;
}
static Integer getCreator(Integer partyid){
int noCreator = 0;
try{
containPID(partyid);
return creator.get(partyid);
}
catch (ctException temp){
temp = null;
return noCreator;
}
}
private static void containSID(Integer socketid) throws ctException{
if(!SID.containsKey(socketid)){
throw new ctException("Not finded SID Key!");
}
}
private static void containPID(Integer partyid) throws ctException{
if(!PID.containsKey(partyid)){
throw new ctException("Not finded PID Key!");
}
}
}

228
src/client.java

@ -1,43 +1,71 @@
import javax.json.Json;
import javax.json.stream.JsonParser;
import javax.json.stream.JsonParsingException;
import javax.xml.bind.DatatypeConverter;
import java.io.*;
import java.math.BigDecimal;
import java.net.*;
import java.security.MessageDigest;
import java.security.NoSuchAlgorithmException;
import java.util.NoSuchElementException;
import java.util.Scanner;
import java.util.concurrent.Exchanger;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
/**
* Created by itsmy on 08.08.2016.
*/
public class client extends Thread {
public class Client extends Thread {
public class Info{
Integer VKID,DURATION;
String PLAYLIST,PROTOCOL,AUDIOID;
BigDecimal TIME, TRACKTIME;
Boolean AP;
private void initInstance(){
VKID = 0;
DURATION = 0;
PLAYLIST = "";
PROTOCOL = "";
AUDIOID = "";
TIME = BigDecimal.ZERO;
TRACKTIME = BigDecimal.ZERO;
AP = false;
}
}
private Socket socket;
private OutputStream out;
private InputStream in;
private Integer socketid;
private Boolean isClosing = false;
private Boolean _instanceClosed = false;
// private Boolean isClosing = false;
public void openSocket(Socket s) throws IOException {
public void initSocket(Socket s) throws IOException {
socket = s;
out = socket.getOutputStream();
in = socket.getInputStream();
socketid = socketInfo.getNewID();
console.debug("Create new socket " + socketid);
socketInfo.create(this, socketid);
socketid = SocketMaps.addClient(this, new Info());
try {
SocketMaps.getInfo(socketid).initInstance();
}
catch (ctException e){
Console.socket(socketid,"Try to close!");
}
Console.debug("Create new socket " + socketid);
start();
}
public void run() {
console.socket(socketid, "New connection");
wsControl();
Console.socket(socketid, "New connection");
runSocket();
}
public void close() {
if(!socketInfo.isOnline(socketid)){
public void closeSocket(){
if(!_instanceClosed){
_instanceClosed = true;
}
else{
return;
}
try {
@ -46,46 +74,52 @@ public class client extends Thread {
socket.close();
} catch (IOException e) {
}
console.socket(socketid, "Disconnected");
socketInfo.close(socketid);
try {
SocketMaps.removeClient(socketid);
SocketMaps.removeClient(socketid);
Console.socket(socketid, "Disconnected");
}catch (ctException e){
Console.socket(socketid,e.toString());
}
}
public void wsControl() {
handshake();
if (!socketInfo.isHttpAuth(socketid)) {
return;
void checkProtocol(Integer socketid, String msg) throws ctException{
if(SocketMaps.getInfo(socketid).PROTOCOL.equals("1A")){
}else{
throw new ctException("Protocol verify failed!");
}
}
public void runSocket(){
try {
handshake();
String msg = readSocket();
parseInput(msg);
if(!socketInfo.isProtocolAuth(socketid)){socketInfo.checkProtocol(socketid);}
if(!socketInfo.isProtocolAuth(socketid)){close(); return;}
eventHandler.connect(socketid);
while (socketInfo.isOnline(socketid)) {
checkProtocol(socketid, msg);
SocketMaps.setRole(socketid, SocketMaps.Roles.LISTNER);
EventHandler.connect(socketid, SocketMaps.getPID(socketid));
while (!_instanceClosed) {
msg = readSocket();
parseInput(msg);
eventExecute();
}
}
public void eventExecute(){
int id = socketInfo.findSocket.bySID(socketid);
if(id == -1){return;}
switch (socketInfo.EVENT.get(id)){
case "play": eventHandler.play(socketid);
break;
case "pause": eventHandler.pause(socketid);
break;
case "next": eventHandler.next(socketid);
switch (SocketMaps.getRole(socketid)){
case CREATOR:
EventHandler.sendParty(socketid);
break;
case "prev": eventHandler.prev(socketid);
break;
case "wind": eventHandler.wind(socketid);
case LISTNER:
break;
}
}
}catch (ctException e){
closeSocket();
e.printStackTrace();
}catch (Exception e){
e.printStackTrace();
}
}
private String bytesToStringUTFCustom(int[] ints) {
private String bytesToString(int[] ints) {
//TODO: добавить поддержку русского языка
char[] buffer = new char[ints.length];
for (int i = 0; i < buffer.length; i++) {
@ -95,10 +129,8 @@ public class client extends Thread {
return new String(buffer);
}
private void handshake() {
if(!socketInfo.isOnline(socketid)){close(); return;}
private void handshake() throws ctException {
try {
if (!socketInfo.isHttpAuth(socketid)) {
socket.setSoTimeout(2000);
String data = new Scanner(in, "UTF-8").useDelimiter("\\r\\n\\r\\n").next();
Matcher get = Pattern.compile("^GET").matcher(data);
@ -120,32 +152,28 @@ public class client extends Thread {
.getBytes("UTF-8");
out.write(response, 0, response.length);
} catch (IOException | NoSuchAlgorithmException e) {
console.out("Server Error:", e.toString());
Console.out("Server Error:", e.toString());
}
socket.setSoTimeout(0);
socketInfo.setHttpAuth(socketid, true);
console.socket(socketid, "Handshake accepted!");
}
Console.socket(socketid, "Handshake accepted!");
}
} catch (SocketException ignored) {
} catch (NoSuchElementException e) {
console.socket(socketid, "Handshake Timeout (2000ms)");
socketInfo.setHttpAuth(socketid, false);
close();
Console.socket(socketid, "Handshake Timeout (2000ms)");
closeSocket();
} catch(IllegalStateException e){
console.socket(socketid, "Bad handshake request!");
close();
Console.socket(socketid, "Bad handshake request!");
closeSocket();
}
}
public Boolean sendSocket(String message) {
if(!socketInfo.isOnline(socketid)){close(); return false;}
public Boolean writeSocket(String message) {
byte[] response;
byte[] r;
try {
response = message.getBytes("UTF-8");
} catch (UnsupportedEncodingException e) {
console.socket(socketid, "Unsupported encoding!");
Console.socket(socketid, "Unsupported encoding!");
return false;
} catch (NullPointerException e) {
return false;
@ -176,21 +204,20 @@ public class client extends Thread {
r[8] = (byte) (response.length >>> 8);
r[9] = (byte) (response.length);
} else {
console.out("Socket Exception", "Too long message for sending! (>64bit)");
Console.out("Socket Exception", "Too long message for sending! (>64bit)");
return false;
}
try {
out.write(r, 0, r.length);
return true;
} catch (IOException e) {
console.out("Socket Exeption", "Client socket is closed?! Closing socket connection!");
close();
Console.out("Socket Exeption", "Client socket is closed?! Closing socket connection!");
closeSocket();
return false;
}
}
public String readSocket() {
if(!socketInfo.isOnline(socketid)){close(); return null;}
String out = "";
try {
int[] MSG = new int[0];
@ -200,10 +227,10 @@ public class client extends Thread {
int OPCODE = in.read(); //читаем OPCODE byte
switch (OPCODE) {
case -1:
close(); //закрываем чтение потока при -1
closeSocket(); //закрываем чтение потока при -1
return null;
case 136:
close();
closeSocket();
return null;
case 129:
LENGTH = in.read(); //читаем второй бит с данными о размере сообщения
@ -246,23 +273,22 @@ public class client extends Thread {
MSG[j] = (byte) (enc ^ KEY[j & 0x3]);
}
if (MSG.length > 0) {
out = bytesToStringUTFCustom(MSG);
out = bytesToString(MSG);
} else {
return null;
}
}
} catch (IOException e) {
console.out("Socket Exception", "Client socket is closed?! Closing socket connection!");
close();
Console.out("Socket Exception", "Client socket is closed?! Closing socket connection!");
closeSocket();
}
if(!socketInfo.isOnline(socketid)){close(); return null;}
console.socket(socketid, "Получаю: " + out);
Console.socket(socketid, "Получаю: " + out);
return out;
}
public Boolean parseInput(String input) {
if(!socketInfo.isOnline(socketid)){close();return false;}
public Boolean parseInput(String input) throws ctException{
try {
Info inf = SocketMaps.getInfo(socketid);
String keyName = null;
JsonParser jsonParser = Json.createParser(new StringReader(input));
while (jsonParser.hasNext()) {
@ -272,30 +298,86 @@ public class client extends Thread {
keyName = jsonParser.getString();
break;
case VALUE_STRING:
socketInfo.setString(socketid, keyName, jsonParser.getString());
setString(socketid, keyName, jsonParser.getString(), inf);
break;
case VALUE_NUMBER:
socketInfo.setInteger(socketid, keyName, jsonParser.getBigDecimal());
setInteger(socketid, keyName, jsonParser.getBigDecimal(), inf);
break;
case VALUE_FALSE:
socketInfo.setBoolean(socketid, keyName, false);
setBoolean(socketid, keyName, false, inf);
break;
case VALUE_TRUE:
socketInfo.setBoolean(socketid, keyName, true);
setBoolean(socketid, keyName, true, inf);
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(socketid,"Request parsing error!");
Console.socket(socketid,"Request parsing error!");
return false;
}catch(JsonParsingException e){
Console.socket(socketid, "JSON Parsing Error!");
return false;
}
}
public static void setString(Integer sid, String keyName, String value, Info inf) throws ctException {
switch (keyName) {
case "EVENT":
switch (value){
case "play":
SocketMaps.setEID(sid, SocketMaps.Events.PLAY);
break;
case "pause":
SocketMaps.setEID(sid, SocketMaps.Events.PAUSE);
break;
case "rewind":
SocketMaps.setEID(sid, SocketMaps.Events.REWIND);
break;
case "DISCONNECT":
SocketMaps.setEID(sid, SocketMaps.Events.DISCONNECT);
}
break;
case "AID":
inf.AUDIOID = value;
break;
case "PROTOCOL":
inf.PROTOCOL = value;
break;
case "PLAYLIST":
inf.PLAYLIST = value;
break;
}
}
public static void setInteger(Integer sid, String keyName, BigDecimal value, Info inf)
throws ctException{
switch (keyName){
case "USERID": inf.VKID = value.intValueExact();
break;
case "TIME": inf.TIME = value;
break;
case "TRACKTIME": inf.TRACKTIME = value;
break;
case "PARTYID": SocketMaps.setPID(sid, value.intValueExact());
break;
case "DURATION": inf.DURATION = value.intValueExact();
break;
}
}
public static void setBoolean(Integer sid, String keyName, Boolean value, Info inf){
switch (keyName) {
case "AP":
inf.AP = value.booleanValue();
break;
}
}
}

103
src/console.java

@ -1,6 +1,7 @@
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.net.Socket;
import java.time.Clock;
import java.util.ArrayList;
import java.util.regex.Pattern;
@ -8,7 +9,7 @@ import java.util.regex.Pattern;
/**
* Created by itsmy on 08.08.2016.
*/
public class console extends Thread{
public class Console extends Thread{
private BufferedReader in;
private String line;
@ -52,7 +53,7 @@ public class console extends Thread{
}
public void run() {
console.out("Server", "Welcome to the ctServer/build25");
Console.out("Server", "Welcome to the CtServer[BUILD 030]");
while (line.equalsIgnoreCase("/stop") == false) {
try{
line = in.readLine();
@ -80,109 +81,103 @@ public class console extends Thread{
case "/restart":
cRestart();
break;
default: console.out("Server","Введите /help для помощи");
default: Console.out("Server","Введите /help для помощи");
}
}catch (IOException e){
console.out("Console","Something goes wrong...");
Console.out("Console","Something goes wrong...");
}catch (NumberFormatException e){
console.out("Console","Hey guy, don't be so crazy!!!");
Console.out("Console","Hey guy, don't be so crazy!!!");
}catch (ctException e){
}
}
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() {
private void cList() throws ctException {
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));
Console.out("Server","/list");
for(int i = 0; SocketMaps.getAllClients().size() > i; i++){
sid = SocketMaps.getAllClients().get(i);
if(SocketMaps.getInfo(sid).PROTOCOL == "1A") {
Console.socket(sid,"VKID " + SocketMaps.getInfo(sid).VKID
+ " PROTOCOL " + SocketMaps.getInfo(sid).PROTOCOL
+ " EVENT " + SocketMaps.getEID(sid)
+ " PARTYID " + SocketMaps.getPID(sid)
+ " TIME " + SocketMaps.getInfo(sid).TIME
+ " TRACKDURATION " + SocketMaps.getInfo(sid).DURATION);
}else{
console.socket(sid,"Protocol not checked!");
Console.socket(sid,"Protocol not checked!");
}
}
}
private void cKick(String[] sx) {
private void cKick(String[] sx) throws ctException{
Integer sid;
sid = Integer.valueOf(sx[1]);
if(socketInfo.findSocket.bySID(Integer.valueOf(sx[1])) != -1){
socketInfo.getClient(sid).close();
}
SocketMaps.getClient(sid).closeSocket();
}
private void cSend(String[] sx) {
private void cSend(String[] sx) throws ctException {
Integer sid;
sid = socketInfo.findSocket.bySID(Integer.valueOf(sx[1]));
if(sid != -1){
sid = Integer.valueOf(sx[1]);
String msg = "";
for (int i = 2; i < sx.length ; i++) {
msg += " ";
msg += sx[i];
}
socketInfo.getClient(Integer.valueOf(sx[1])).sendSocket(msg);
}
SocketMaps.getClient(sid).writeSocket(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");
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) {
private void cInfo(String[] sx) throws ctException {
Integer sid;
Integer id;
if(sx.length < 3){
console.out("Server","/info [pid/sid] <id>");
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));
Console.socket(sid,"VKID " + SocketMaps.getInfo(sid).VKID
+ " PROTOCOL " + SocketMaps.getInfo(sid).PROTOCOL
+ " EVENT " + SocketMaps.getEID(sid)
+ " PARTYID " + SocketMaps.getPID(sid)
+ " TRACKDURATION " + SocketMaps.getInfo(sid).DURATION);
break;
case "pid":
ArrayList<Integer> a = socketInfo.findSocket.byPID(Integer.valueOf(sx[2]));
Integer pid = Integer.valueOf(sx[2]);
ArrayList<Integer> a = SocketMaps.getAllParty(pid);
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));
Console.socket(a.get(i),"VKID " + SocketMaps.getInfo(a.get(i)).VKID
+ " PROTOCOL " + SocketMaps.getInfo(a.get(i)).PROTOCOL
+ " EVENT " + SocketMaps.getEID(a.get(i))
+ " PARTYID " + SocketMaps.getPID(a.get(i))
+ " TRACKDURATION " + SocketMaps.getInfo(a.get(i)).DURATION);
}
break;
default:
console.out("Server", "/info [pid/sid] <id>");
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\"}");
ArrayList<Integer> TempList= SocketMaps.getAllClients();
for (int i = 0; i < TempList.size(); i++) {
try{
SocketMaps.getClient(TempList.get(i)).writeSocket("{\"EVENT\":\"RESTART\"}");
}catch (ctException ct){}
}
System.exit(99);
}

8
src/ctException.java

@ -0,0 +1,8 @@
/**
* Created by itsmy_000 on 12.09.2016.
*/
class ctException extends Exception {
ctException(String message) {
super(message);
}
}

18
src/ctServer.java

@ -1,29 +1,29 @@
import java.net.*;
import java.io.*;
public class ctServer {
public class CtServer {
public static void main(String[] args) throws IOException{
socketInfo.init();
SocketMaps.initMaps();
try{
new console().consoleListner();
new Console().consoleListner();
}
catch (IOException ignored){}
int port = 80;
console.out("Socket Port", port+"");
ServerSocket ss = new ServerSocket(port);
Console.out("Socket Port", port+"");
ServerSocket instance = new ServerSocket(port);
try {
console.out("Server", "Waiting for a client");
Console.out("Server", "Waiting for a Client");
while(true) {
Socket socket = ss.accept();
Socket socket = instance.accept();
try {
new client().openSocket(socket);
new Client().initSocket(socket);
} catch (IOException e) {
socket.close();
}
}
} finally {
ss.close();
instance.close();
}
}

171
src/eventHandler.java

@ -1,159 +1,96 @@
import jdk.nashorn.internal.parser.JSONParser;
import javax.json.Json;
import javax.json.JsonObject;
import javax.json.JsonObjectBuilder;
import java.net.Socket;
import java.util.ArrayList;
/**
* Created by itsmy on 15.08.2016.
*/
public class eventHandler {
//TODO: переписать почти весь код здесь
//Нужно покончить с этим быдланством
public static synchronized void connect(Integer sid){
public class EventHandler {
/*TODO: разделить метод на несколько методов
* Метод записи ролей
* Метод сборки JSON
* Метод рассылки по клиентам
*/
public static synchronized void connect(Integer socketid, Integer partyid) throws ctException{
ArrayList<Integer> a = SocketMaps.getAllParty(partyid);
if(a.size() == 1) {
//Если клиент первым подключился, то он управляет
SocketMaps.setCreator(partyid, socketid);
SocketMaps.setRole(socketid, SocketMaps.Roles.CREATOR);
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);
SocketMaps.getClient(socketid).writeSocket(cc.toString());
} else if(a.size() > 1) {
//Если клиент уже не первый, то всем остальным клиентам идет рассылка о новом подключении
SocketMaps.setRole(socketid, SocketMaps.Roles.LISTNER);
JsonObjectBuilder creator = Json.createObjectBuilder();
creator.add("ONLINE" , a.size()-1);
for (int i = 0; i < a.size(); i++) {
if(socketInfo.ROLE.get(i) == 0){
switch (SocketMaps.getRole(a.get(i))) {
case CREATOR:
JsonObject cc = creator.build();
socketInfo.CLIENT.get(a.get(i)).sendSocket(cc.toString());
}
else{
SocketMaps.getClient(a.get(i)).writeSocket(cc.toString());
break;
case LISTNER:
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());
SocketMaps.getClient(a.get(i)).writeSocket(lc.toString());
break;
}
}
socketInfo.CLIENT.get(id).eventExecute();
}
}
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;}
public static JsonObject buildEvent(Integer socketid) throws ctException{
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);
Integer pid = SocketMaps.getPID(socketid);
switch (SocketMaps.getEID(SocketMaps.getCreator(pid))){
case PLAY: creator.add("EVENT", "play");
break;
case PAUSE: creator.add("EVENT", "pause");
break;
case REWIND: creator.add("EVENT", "rewind");
break;
case DISCONNECT: SocketMaps.getClient(socketid).closeSocket();
return null;
}
creator.add(Protocol._1A.TIME, SocketMaps.getInfo(socketid).TIME);
creator.add(Protocol._1A.AID, SocketMaps.getInfo(socketid).AUDIOID);
creator.add(Protocol._1A.TRACKTIME, SocketMaps.getInfo(socketid).TRACKTIME);
creator.add(Protocol._1A.DURATION, SocketMaps.getInfo(socketid).DURATION);
creator.add(Protocol._1A.PLAYLIST, SocketMaps.getInfo(socketid).PLAYLIST);
creator.add(Protocol._1A.AP, SocketMaps.getInfo(socketid).AP);
JsonObject main = creator.build();
return main;
}
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 sendClient(Integer socketid) throws ctException{
JsonObject main = buildEvent(socketid);
SocketMaps.getClient(socketid).writeSocket(main.toString());
}
public static void eventSender(Integer id, JsonObjectBuilder creator){
ArrayList<Integer> a = socketInfo.findSocket.byPID(socketInfo.PARTYID.get(id));
public static void sendParty(Integer socketid) throws ctException{
JsonObject main = buildEvent(socketid);
if(main == null){return;}
ArrayList<Integer> a = SocketMaps.getAllParty(SocketMaps.getPID(socketid));
for (int i = 0; i < a.size(); i++) {
JsonObject c = creator.build();
socketInfo.CLIENT.get(a.get(i)).sendSocket(c.toString());
SocketMaps.getClient(a.get(i)).writeSocket(main.toString());
Console.socket(a.get(i),main.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);
}
}

188
src/socketInfo.java

@ -1,188 +0,0 @@
import com.sun.istack.internal.NotNull;
import java.math.BigDecimal;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.function.BooleanSupplier;
/**
* Created by itsmy_000 on 13.08.2016.
*/
public class socketInfo {
// public enum EVENT{PLAY,NEXT,REWIND,PAUSE,PREV,SCROB}
// public static ArrayList<EVENT> EVENTS;
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 Integer sid;
public static void init(){
sid = 0;
VKID = new ArrayList<>();
TIME = new ArrayList<>();
TRACKTIME = new ArrayList<>();
ROLE = new ArrayList<>();
EVENT = new ArrayList<>();
CLIENT = new ArrayList<>();
PARTYID = new ArrayList<>();
TRACKID = new ArrayList<>();
PROTOCOL = new ArrayList<>();
DURATION = new ArrayList<>();
SOCKETID = new ArrayList<>();
ONLINE = new ArrayList<>();
httpAuth = new ArrayList<>();
protocolAuth = new ArrayList<>();
AUTOPLAY = new ArrayList<>();
}
public static void create(client c, Integer sid){
VKID.add(0);
TIME.add(BigDecimal.ZERO);
TRACKTIME.add(BigDecimal.ZERO);
ROLE.add(1);
EVENT.add("");
ONLINE.add(true);
CLIENT.add(c);
TRACKID.add("");
PROTOCOL.add("");
PARTYID.add(0);
DURATION.add(0);
SOCKETID.add(sid);
httpAuth.add(false);
protocolAuth.add(false);
AUTOPLAY.add(false);
}
public static void close(Integer sid){
int s = findSocket.bySID(sid);
VKID.remove(s);
ROLE.remove(s);
PROTOCOL.remove(s);
EVENT.remove(s);
TRACKID.remove(s);
SOCKETID.remove(s);
TIME.remove(s);
TRACKTIME.remove(s);
DURATION.remove(s);
PARTYID.remove(s);
CLIENT.remove(s);
ONLINE.remove(s);
httpAuth.remove(s);
protocolAuth.remove(s);
AUTOPLAY.remove(s);
}
public static Integer getNewID(){
sid++;
return sid;
}
public static class findSocket extends socketInfo{
public static Integer bySID(Integer s){
int id = -1;
for (int i = 0; i < SOCKETID.size(); i++) {
if(SOCKETID.get(i).equals(s)){
id = i;
}
}
return id;
}
public static ArrayList<Integer> byPID(Integer pid){
ArrayList<Integer> a = new ArrayList<>();
for (int i = 0; i < PARTYID.size(); i++) {
if(PARTYID.get(i).equals(pid)){
a.add(i);
}
}
return a;
}
}
public static void setHttpAuth(Integer sid, Boolean b){
int s = findSocket.bySID(sid);
if(s == -1) return;
httpAuth.set(s, b);
}
public static void checkProtocol(Integer sid){
int s = findSocket.bySID(sid);
if(s == -1) return;
if(PROTOCOL.get(s).equals("1A")){
protocolAuth.set(s, true);
}
}
public static Boolean isProtocolAuth(Integer sid){
int s = findSocket.bySID(sid);
if(s == -1) return Boolean.FALSE;
return protocolAuth.get(s);
}
public static Boolean isHttpAuth(Integer sid){
int s = findSocket.bySID(sid);
if(s == -1) return Boolean.FALSE;
return httpAuth.get(s);
}
public static Boolean isOnline(Integer sid){
int s = findSocket.bySID(sid);
if(s == -1) return Boolean.FALSE;
return ONLINE.get(s);
}
public static client getClient(Integer sid){
int s = findSocket.bySID(sid);
if(s == -1) return null;
return socketInfo.CLIENT.get(s);
}
public static void setString(Integer sid, String keyName, String value) {
int s = findSocket.bySID(sid);
if (s == -1) return;
switch (keyName) {
case "EVENT":
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, BigDecimal value){
int s = findSocket.bySID(sid);
if(s == -1) return;
switch (keyName){
case "vk_id": VKID.set(s, value.intValueExact());
break;
case "tm": TIME.set(s, value);
break;
case "tT": TRACKTIME.set(s, value);
break;
case "partyId": PARTYID.set(s, value.intValueExact());
break;
case "tD": DURATION.set(s, value.intValueExact());
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