Package var.sockets.tcp.time
Class TimeTextServer
- java.lang.Object
-
- var.sockets.tcp.time.TimeTextServer
-
public class TimeTextServer extends java.lang.Object
iterative server for var.sockets.tcp.time Time service. waits for the next client to connect, then sends time back. format for time is short date and time according to current locale.- Author:
- Sandro Leuchter
-
-
Field Summary
Fields Modifier and Type Field Description private int
port
port on which this service is currently listening on localhost
-
Constructor Summary
Constructors Constructor Description TimeTextServer(int port)
the only constructor for this class
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static void
main(java.lang.String[] args)
main method: entrypoint to runvoid
startServer()
creates server socket on localhost:port, infinitely handles connections to clients one after another: waits for the next client to connect, send time back.
-
-
-
Field Detail
-
port
private final int port
port on which this service is currently listening on localhost
-
-
Constructor Detail
-
TimeTextServer
public TimeTextServer(int port)
the only constructor for this class- Parameters:
port
- port on which this service will be listening on localhost
-
-
Method Detail
-
startServer
public void startServer()
creates server socket on localhost:port, infinitely handles connections to clients one after another: waits for the next client to connect, send time back. format for time is short date and time according to current locale.
-
main
public static void main(java.lang.String[] args)
main method: entrypoint to run- Parameters:
args
- args[0] must be the port number of the server (int); rest of args is ignored
-
-