jsc
βββ jConnection
βΒ Β βββ JCloseEventConsumer.java
βΒ Β βββ JConnection.java
βΒ Β βββ JConnectionManager.java
βββ jEventManager
βΒ Β βββ JEventCode.java
βΒ Β βββ JEventConsumer.java
βΒ Β βββ JEventDataSender.java
βΒ Β βββ JEventManager.java
βΒ Β βββ JEventType.java
βββ jMessageHandler
βΒ Β βββ JFileConsumer.java
βΒ Β βββ JMessageCode.java
βΒ Β βββ JMessageConsumer.java
βΒ Β βββ JMessageDelimiter.java
βΒ Β βββ JMessageFormatHandler.java
βΒ Β βββ JMessageSender.java
βΒ Β βββ JMessageType.java
βββ jObjectParser
βΒ Β βββ JObjectParseException.java
βΒ Β βββ JObjectParser.java
βββ jServer
βββ JClientConnectionsHandler.java
βββ JConnectionHandler.java
βββ JRequestManager.java
βββ JResponseSender.java
βββ JServer.java
βββ JSocketConsumer.java
5 directories, 23 files
*click any of the above highlighted file to navigate to its source code
-
-
EchoServer.java
import jsc.jServer.JServer; import java.io.IOException; public class EchoServer { public static void main(String []s){ try{ JServer echoServer = new JServer(EchoJRequestManagerImpl.class); echoServer.start(); }catch (IOException e){ System.out.println("Unable to start server :("); } } }
EchoJRequestManagerImpl.java
import jsc.jServer.JRequestManager; public class EchoJRequestManagerImpl extends JRequestManager { @Override public void accept(String req){ //write your logic here to serve the request System.out.println("Received Request: "+req); write(req); } }
- Default server port:
5656
-
javac -cp JSERVER.jar EchoJRequestManagerImpl.java javac -cp JSERVER.jar:. EchoServer.java java -cp JSERVER.jar:. EchoServer
-
-
-
TestRelayEchoClient.java
import jsc.jConnection.JConnection; import java.io.IOException; import java.util.Scanner; public class TestRelayEchoClient { public static Scanner scanner = new Scanner(System.in); public static void main(String []s){ try{ JConnection jConnection = new JConnection("127.0.0.1", 5656, (res)->{ //write your logic here to consume the response System.out.println(res); }); jConnection.run(); System.out.println("Write your message and press enter...(write \"exit\" to stop)"); String msg; while(jConnection.isConnected()){ msg = scanner.nextLine(); if(msg.equals("exit")){ break; } jConnection.write(msg); } jConnection.close(); System.out.println("----------- Bye :) -----------"); }catch (IOException ioE){ System.out.println("Server connection lost, check your network connection :("); } } }
- Output:
Write your message and press enter...(write "exit" to stop) Hello, Server! Hello, Server! JSC is perfectly working :) JSC is perfectly working :) exit ----------- Bye :) ----------- anonymous disconnected!
-
JSC
βββ JConnection
βΒ Β βββ JConnection.iml
βΒ Β βββ pom.xml
βΒ Β βββ src
βΒ Β βΒ Β βββ main
βΒ Β βΒ Β βΒ Β βββ java
βΒ Β βΒ Β βΒ Β βΒ Β βββ jsc
βΒ Β βΒ Β βΒ Β βΒ Β βββ jConnection
βΒ Β βΒ Β βΒ Β βΒ Β βΒ Β βββ JCloseEventConsumer.java
βΒ Β βΒ Β βΒ Β βΒ Β βΒ Β βββ JConnection.java
βΒ Β βΒ Β βΒ Β βΒ Β βΒ Β βββ JConnectionManager.java
βΒ Β βΒ Β βΒ Β βΒ Β βββ jEventManager
βΒ Β βΒ Β βΒ Β βΒ Β βΒ Β βββ JEventCode.java
βΒ Β βΒ Β βΒ Β βΒ Β βΒ Β βββ JEventConsumer.java
βΒ Β βΒ Β βΒ Β βΒ Β βΒ Β βββ JEventDataSender.java
βΒ Β βΒ Β βΒ Β βΒ Β βΒ Β βββ JEventManager.java
βΒ Β βΒ Β βΒ Β βΒ Β βΒ Β βββ JEventType.java
βΒ Β βΒ Β βΒ Β βΒ Β βββ jMessageHandler
βΒ Β βΒ Β βΒ Β βΒ Β βΒ Β βββ JFileConsumer.java
βΒ Β βΒ Β βΒ Β βΒ Β βΒ Β βββ JMessageCode.java
βΒ Β βΒ Β βΒ Β βΒ Β βΒ Β βββ JMessageConsumer.java
βΒ Β βΒ Β βΒ Β βΒ Β βΒ Β βββ JMessageDelimiter.java
βΒ Β βΒ Β βΒ Β βΒ Β βΒ Β βββ JMessageFormatHandler.java
βΒ Β βΒ Β βΒ Β βΒ Β βΒ Β βββ JMessageSender.java
βΒ Β βΒ Β βΒ Β βΒ Β βΒ Β βββ JMessageType.java
βΒ Β βΒ Β βΒ Β βΒ Β βββ jObjectParser
βΒ Β βΒ Β βΒ Β βΒ Β βββ JObjectParseException.java
βΒ Β βΒ Β βΒ Β βΒ Β βββ JObjectParser.java
βΒ Β βΒ Β βΒ Β βββ resources
βΒ Β βΒ Β βββ test
βΒ Β βΒ Β βββ java
βΒ Β βΒ Β βββ jsc
βΒ Β βΒ Β βββ jConnection
βΒ Β βΒ Β βββ JConnectionTest.java
βΒ Β βββ target
βΒ Β βββ classes
βΒ Β βΒ Β βββ jsc
βΒ Β βΒ Β βββ jConnection
βΒ Β βΒ Β βΒ Β βββ JCloseEventConsumer.class
βΒ Β βΒ Β βΒ Β βββ JConnection.class
βΒ Β βΒ Β βΒ Β βββ JConnectionManager.class
βΒ Β βΒ Β βββ jEventManager
βΒ Β βΒ Β βΒ Β βββ JEventCode.class
βΒ Β βΒ Β βΒ Β βββ JEventConsumer.class
βΒ Β βΒ Β βΒ Β βββ JEventDataSender.class
βΒ Β βΒ Β βΒ Β βββ JEventManager.class
βΒ Β βΒ Β βΒ Β βββ JEventType.class
βΒ Β βΒ Β βββ jMessageHandler
βΒ Β βΒ Β βΒ Β βββ JFileConsumer.class
βΒ Β βΒ Β βΒ Β βββ JMessageCode.class
βΒ Β βΒ Β βΒ Β βββ JMessageConsumer.class
βΒ Β βΒ Β βΒ Β βββ JMessageDelimiter.class
βΒ Β βΒ Β βΒ Β βββ JMessageFormatHandler.class
βΒ Β βΒ Β βΒ Β βββ JMessageSender.class
βΒ Β βΒ Β βΒ Β βββ JMessageType.class
βΒ Β βΒ Β βββ jObjectParser
βΒ Β βΒ Β βββ JObjectParseException.class
βΒ Β βΒ Β βββ JObjectParser.class
βΒ Β βββ generated-sources
βΒ Β βΒ Β βββ annotations
βΒ Β βββ generated-test-sources
βΒ Β βΒ Β βββ test-annotations
βΒ Β βββ test-classes
βΒ Β βββ jsc
βΒ Β βββ jConnection
βΒ Β βββ JConnectionTest.class
βββ JSERVER
βΒ Β βββ JSERVER.iml
βΒ Β βββ pom.xml
βΒ Β βββ src
βΒ Β βΒ Β βββ main
βΒ Β βΒ Β βΒ Β βββ java
βΒ Β βΒ Β βΒ Β βΒ Β βββ jsc
βΒ Β βΒ Β βΒ Β βΒ Β βββ jServer
βΒ Β βΒ Β βΒ Β βΒ Β βββ JClientConnectionsHandler.java
βΒ Β βΒ Β βΒ Β βΒ Β βββ JConnectionHandler.java
βΒ Β βΒ Β βΒ Β βΒ Β βββ JRequestManager.java
βΒ Β βΒ Β βΒ Β βΒ Β βββ JResponseSender.java
βΒ Β βΒ Β βΒ Β βΒ Β βββ JServer.java
βΒ Β βΒ Β βΒ Β βΒ Β βββ JSocketConsumer.java
βΒ Β βΒ Β βΒ Β βββ resources
βΒ Β βΒ Β βββ test
βΒ Β βΒ Β βββ java
βΒ Β βΒ Β βββ EchoJRequestManagerImpl.java
βΒ Β βΒ Β βββ EchoServer.java
βΒ Β βββ target
βΒ Β βββ classes
βΒ Β βΒ Β βββ jsc
βΒ Β βΒ Β βββ jServer
βΒ Β βΒ Β βββ JClientConnectionsHandler.class
βΒ Β βΒ Β βββ JConnectionHandler.class
βΒ Β βΒ Β βββ JRequestManager.class
βΒ Β βΒ Β βββ JResponseSender.class
βΒ Β βΒ Β βββ JServer$RequestHandlerNotFound.class
βΒ Β βΒ Β βββ JServer.class
βΒ Β βΒ Β βββ JSocketConsumer.class
βΒ Β βββ generated-sources
βΒ Β βΒ Β βββ annotations
βΒ Β βββ generated-test-sources
βΒ Β βΒ Β βββ test-annotations
βΒ Β βββ test-classes
βΒ Β βββ EchoJRequestManagerImpl.class
βΒ Β βββ EchoServer.class
βββ libs
βββ JConnection.jar
βββ JSERVER.jar
47 directories, 59 files
*click any of the above highlighted file to navigate to its source code