formatting & lower case folders
This commit is contained in:
@@ -5,18 +5,20 @@ import java.io.IOException;
|
|||||||
import java.net.Socket;
|
import java.net.Socket;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Sends a ping to the server ("CPING") every 2 seconds and checks if it has gotten a pingback.
|
* Sends a ping to the server ("CPING") every 2 seconds and checks if it has gotten a pingback. The
|
||||||
* The actual logging of the pingback (via the gotPingBack boolean) has to be done elsewhere,
|
* actual logging of the pingback (via the gotPingBack boolean) has to be done elsewhere, depends on
|
||||||
* depends on how the client receives and parses messages.
|
* how the client receives and parses messages.
|
||||||
*/
|
*/
|
||||||
public class ClientPinger implements Runnable{
|
public class ClientPinger implements Runnable {
|
||||||
private boolean gotPingBack; //should be set to true (via setGotPingBack) as soon as the client gets a pingback.
|
|
||||||
|
private boolean gotPingBack; //should be set to true when client gets a pingback.
|
||||||
private boolean isConnected; //set to true unless the ClientPinger detects a connection loss.
|
private boolean isConnected; //set to true unless the ClientPinger detects a connection loss.
|
||||||
BufferedWriter out; //the output of this client through which the pings are sent
|
BufferedWriter out; //the output of this client through which the pings are sent
|
||||||
private Socket socket;
|
private Socket socket;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param socket the socket the Client is connected to which is used to end the thread if the connection is lost.
|
* @param socket the socket the Client is connected to which is used to end the thread if the
|
||||||
|
* connection is lost.
|
||||||
* @param out the output through which the pings are sent.
|
* @param out the output through which the pings are sent.
|
||||||
*/
|
*/
|
||||||
public ClientPinger(BufferedWriter out, Socket socket) {
|
public ClientPinger(BufferedWriter out, Socket socket) {
|
||||||
|
|||||||
@@ -5,18 +5,20 @@ import java.io.IOException;
|
|||||||
import java.net.Socket;
|
import java.net.Socket;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Sends a ping to the client ("SPING") every 2 seconds and checks if it has gotten a pingback.
|
* Sends a ping to the client ("SPING") every 2 seconds and checks if it has gotten a pingback. The
|
||||||
* The actual logging of the pingback (via the gotPingBack boolean) has to be done elsewhere,
|
* actual logging of the pingback (via the gotPingBack boolean) has to be done elsewhere, depends on
|
||||||
* depends on how the server receives and parses messages.
|
* how the server receives and parses messages.
|
||||||
*/
|
*/
|
||||||
public class ServerPinger implements Runnable{
|
public class ServerPinger implements Runnable {
|
||||||
|
|
||||||
private boolean gotPingBack; //should be set to true (via setGotPingBack) as soon as the server gets a pingback.
|
private boolean gotPingBack; //should be set to true (via setGotPingBack) as soon as the server gets a pingback.
|
||||||
private boolean isConnected; //set to true unless the ServerPinger detects a connection loss.
|
private boolean isConnected; //set to true unless the ServerPinger detects a connection loss.
|
||||||
BufferedWriter out; //the output of this client through which the pings are sent
|
BufferedWriter out; //the output of this client through which the pings are sent
|
||||||
private Socket socket;
|
private Socket socket;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param socket the socket the ClientHandler is connected to; used to end the thread if the connection is lost.
|
* @param socket the socket the ClientHandler is connected to; used to end the thread if the
|
||||||
|
* connection is lost.
|
||||||
* @param out the output through which the pings are sent.
|
* @param out the output through which the pings are sent.
|
||||||
*/
|
*/
|
||||||
public ServerPinger(BufferedWriter out, Socket socket) {
|
public ServerPinger(BufferedWriter out, Socket socket) {
|
||||||
|
|||||||
@@ -36,7 +36,7 @@ public class Server {
|
|||||||
|
|
||||||
public void closeServerSocket() {
|
public void closeServerSocket() {
|
||||||
try {
|
try {
|
||||||
if (serverSocket != null){
|
if (serverSocket != null) {
|
||||||
serverSocket.close();
|
serverSocket.close();
|
||||||
}
|
}
|
||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
@@ -55,7 +55,7 @@ public class Server {
|
|||||||
server.startServer();
|
server.startServer();
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void broadcast(String msg){
|
public static void broadcast(String msg) {
|
||||||
//TODO
|
//TODO
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user