Parcourir la source

added Server methods

master
MrTob il y a 5 ans
Parent
révision
3f86275e8a
3 fichiers modifiés avec 188 ajouts et 8 suppressions
  1. +171
    -3
      .idea/workspace.xml
  2. +4
    -1
      src/xyz/nextn/Main.java
  3. +13
    -4
      src/xyz/nextn/Server.java

+ 171
- 3
.idea/workspace.xml Voir le fichier

@@ -2,7 +2,7 @@
<project version="4">
<component name="ChangeListManager">
<list default="true" id="bb3e1b7e-b662-4d08-9145-fd676c7f3d31" name="Default Changelist" comment="">
<change beforePath="$PROJECT_DIR$/src/xyz/nextn/Main.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/xyz/nextn/Main.java" afterDir="false" />
<change beforePath="$PROJECT_DIR$/src/xyz/nextn/Server.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/xyz/nextn/Server.java" afterDir="false" />
</list>
<option name="EXCLUDED_CONVERTED_TO_IGNORED" value="true" />
<option name="SHOW_DIALOG" value="false" />
@@ -10,9 +10,55 @@
<option name="HIGHLIGHT_NON_ACTIVE_CHANGELIST" value="false" />
<option name="LAST_RESOLUTION" value="IGNORE" />
</component>
<component name="DefaultGradleProjectSettings">
<option name="isMigrated" value="true" />
</component>
<component name="FileEditorManager">
<leaf SIDE_TABS_SIZE_LIMIT_KEY="300">
<file pinned="false" current-in-tab="false">
<entry file="file://$PROJECT_DIR$/src/xyz/nextn/Main.java">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="85">
<caret line="5" column="43" lean-forward="true" selection-start-line="5" selection-start-column="43" selection-end-line="5" selection-end-column="43" />
<folding>
<element signature="e#84#85#0" expanded="true" />
<element signature="e#125#126#0" expanded="true" />
</folding>
</state>
</provider>
</entry>
</file>
<file pinned="false" current-in-tab="true">
<entry file="file://$PROJECT_DIR$/src/xyz/nextn/Server.java">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="119">
<caret line="7" column="4" selection-start-line="7" selection-start-column="4" selection-end-line="7" selection-end-column="4" />
</state>
</provider>
</entry>
</file>
<file pinned="false" current-in-tab="false">
<entry file="file://$PROJECT_DIR$/src/xyz/nextn/Client.java">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="34">
<caret line="2" column="13" selection-start-line="2" selection-start-column="13" selection-end-line="2" selection-end-column="13" />
</state>
</provider>
</entry>
</file>
</leaf>
</component>
<component name="Git.Settings">
<option name="RECENT_GIT_ROOT_PATH" value="$PROJECT_DIR$" />
</component>
<component name="IdeDocumentHistory">
<option name="CHANGED_PATHS">
<list>
<option value="$PROJECT_DIR$/src/xyz/nextn/Main.java" />
<option value="$PROJECT_DIR$/src/xyz/nextn/Server.java" />
</list>
</option>
</component>
<component name="ProjectFrameBounds" extendedState="6">
<option name="x" value="20" />
<option name="y" value="21" />
@@ -20,6 +66,37 @@
<option name="height" value="1047" />
</component>
<component name="ProjectLevelVcsManager" settingsEditedManually="true" />
<component name="ProjectView">
<navigator proportions="" version="1">
<foldersAlwaysOnTop value="true" />
</navigator>
<panes>
<pane id="Scope" />
<pane id="PackagesPane" />
<pane id="ProjectPane">
<subPane>
<expand>
<path>
<item name="MessStation" type="b2602c69:ProjectViewProjectNode" />
<item name="MessStation" type="462c0819:PsiDirectoryNode" />
</path>
<path>
<item name="MessStation" type="b2602c69:ProjectViewProjectNode" />
<item name="MessStation" type="462c0819:PsiDirectoryNode" />
<item name="src" type="462c0819:PsiDirectoryNode" />
</path>
<path>
<item name="MessStation" type="b2602c69:ProjectViewProjectNode" />
<item name="MessStation" type="462c0819:PsiDirectoryNode" />
<item name="src" type="462c0819:PsiDirectoryNode" />
<item name="nextn" type="462c0819:PsiDirectoryNode" />
</path>
</expand>
<select />
</subPane>
</pane>
</panes>
</component>
<component name="PropertiesComponent">
<property name="SHARE_PROJECT_CONFIGURATION_FILES" value="true" />
<property name="WebServerToolWindowFactoryState" value="false" />
@@ -69,14 +146,105 @@
<option name="project" value="LOCAL" />
<updated>1569260717145</updated>
</task>
<option name="localTasksCounter" value="2" />
<task id="LOCAL-00002" summary="added server">
<created>1569263446175</created>
<option name="number" value="00002" />
<option name="presentableId" value="LOCAL-00002" />
<option name="project" value="LOCAL" />
<updated>1569263446175</updated>
</task>
<option name="localTasksCounter" value="3" />
<servers />
</component>
<component name="TimeTrackingManager">
<option name="totallyTimeSpent" value="63000" />
</component>
<component name="ToolWindowManager">
<frame x="-8" y="-8" width="1936" height="1056" extended-state="6" />
<editor active="true" />
<layout>
<window_info content_ui="combo" id="Project" order="0" visible="true" weight="0.14072494" />
<window_info id="Structure" order="1" side_tool="true" weight="0.25" />
<window_info id="Capture Tool" order="2" />
<window_info id="Image Layers" order="3" />
<window_info id="Designer" order="4" />
<window_info id="UI Designer" order="5" />
<window_info id="Favorites" order="6" side_tool="true" />
<window_info anchor="bottom" id="Message" order="0" />
<window_info anchor="bottom" id="Find" order="1" />
<window_info anchor="bottom" id="Run" order="2" />
<window_info anchor="bottom" id="Debug" order="3" weight="0.4" />
<window_info anchor="bottom" id="Cvs" order="4" weight="0.25" />
<window_info anchor="bottom" id="Inspection" order="5" weight="0.4" />
<window_info anchor="bottom" id="TODO" order="6" />
<window_info anchor="bottom" id="Docker" order="7" show_stripe_button="false" />
<window_info anchor="bottom" id="Database Changes" order="8" />
<window_info anchor="bottom" id="Terminal" order="9" />
<window_info anchor="bottom" id="Event Log" order="10" sideWeight="0.50053304" side_tool="true" visible="true" weight="0.32936078" />
<window_info active="true" anchor="bottom" id="Version Control" order="11" sideWeight="0.49946696" visible="true" weight="0.32936078" />
<window_info anchor="right" id="Commander" internal_type="SLIDING" order="0" type="SLIDING" weight="0.4" />
<window_info anchor="right" id="Ant Build" order="1" weight="0.25" />
<window_info anchor="right" content_ui="combo" id="Hierarchy" order="2" weight="0.25" />
<window_info anchor="right" id="Palette" order="3" />
<window_info anchor="right" id="Theme Preview" order="4" />
<window_info anchor="right" id="Maven" order="5" />
<window_info anchor="right" id="Capture Analysis" order="6" />
<window_info anchor="right" id="Palette&#9;" order="7" />
<window_info anchor="right" id="Database" order="8" />
</layout>
</component>
<component name="TypeScriptGeneratedFilesManager">
<option name="version" value="1" />
</component>
<component name="Vcs.Log.Tabs.Properties">
<option name="TAB_STATES">
<map>
<entry key="MAIN">
<value>
<State>
<option name="RECENTLY_FILTERED_USER_GROUPS">
<collection />
</option>
<option name="RECENTLY_FILTERED_BRANCH_GROUPS">
<collection />
</option>
<option name="COLUMN_ORDER">
<list>
<option value="0" />
<option value="1" />
<option value="2" />
<option value="3" />
</list>
</option>
</State>
</value>
</entry>
</map>
</option>
</component>
<component name="VcsManagerConfiguration">
<MESSAGE value="git init" />
<option name="LAST_COMMIT_MESSAGE" value="git init" />
<MESSAGE value="added server" />
<option name="LAST_COMMIT_MESSAGE" value="added server" />
</component>
<component name="editorHistoryManager">
<entry file="file://$PROJECT_DIR$/src/xyz/nextn/Main.java">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="85">
<caret line="5" column="43" lean-forward="true" selection-start-line="5" selection-start-column="43" selection-end-line="5" selection-end-column="43" />
<folding>
<element signature="e#84#85#0" expanded="true" />
<element signature="e#125#126#0" expanded="true" />
</folding>
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/src/xyz/nextn/Server.java">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="119">
<caret line="7" column="4" selection-start-line="7" selection-start-column="4" selection-end-line="7" selection-end-column="4" />
</state>
</provider>
</entry>
</component>
</project>

+ 4
- 1
src/xyz/nextn/Main.java Voir le fichier

@@ -3,6 +3,9 @@ package xyz.nextn;
public class Main {

public static void main(String[] args) {
System.out.println("MAYR 500 EUR");

Server server = new Server();
server.start(1111);

}
}

+ 13
- 4
src/xyz/nextn/Server.java Voir le fichier

@@ -9,10 +9,19 @@ import java.net.Socket;
public class Server {
private ServerSocket serverSocket;

public void start(int port) throws IOException {
serverSocket = new ServerSocket(port);
while (true)
new EchoClientHandler(serverSocket.accept()).start();
public void start(int port){
try {
serverSocket = new ServerSocket(port);
} catch (IOException e) {
e.printStackTrace();
}
while (true) {
try {
new EchoClientHandler(serverSocket.accept()).start();
} catch (IOException e) {
e.printStackTrace();
}
}
}

public void stop() throws IOException {


Chargement…
Annuler
Enregistrer