A simple socket server with sequence synchronization Running Server:
-
ant clean compile jar run & runServer.sh runs the above command, it cleans the old classes, compiles a fresh version of them, packages all of them in a jar and then runs the jar.
-
by default the server runs on port 4567, to change the port look at this section in build.xml ------------->> change the port number here
Connecting to the server:
telnet localhost
Assumptions:
-
You need to have atleast 2 words in the string to sync so when input a single number, the output would be that number and normal incremented seq number. eg: 02817a-mapte:Ticketfly mapte$ telnet localhost 4567 Connected to localhost. Escape character is '^]'. try yrt 59 hi ih 60 789 987 61 1 1 62
-
When the input is any word (a number or set of letters) and a number separated by space, that signals syncing eg: 02817a-mapte:Ticketfly mapte$ telnet localhost 4567 Connected to localhost. Escape character is '^]'. hi ih 63 there ereht 64 64 77 46 78 hi ih 79 there ereht 80
-
the character '.' signals end of session from the client, the connection will be closed by the server.