create socket through proxy java - java

I have written the code which have to find the file size using http HEAD request through sockets... i try it in my home with non proxy connection its working ... but when i try it in my college with a proxy server whose ip is 172.16.4.6 and port 1117 it is not working......any suggestion......thanks.
public class Proxytesting {
private static OutputStream os;
private static InputStream in;
private static BufferedReader reader;
private static int Totalsize;
public static void main(String[] args) {
try {
URL url_of_file=new URL("http://www.stockvault.net/data/s/124348.jpg");
String hostaddress=url_of_file.getHost();
////////////////////for proxy server ///////////////////
String textip="172.16.4.7";
InetAddress host=InetAddress.getByName(textip);
System.out.println(host);
int port=1117;
SocketAddress ad=new InetSocketAddress(host, 1117);
Proxy proxy = new Proxy(Proxy.Type.SOCKS, ad);
Socket mysocket2 = new java.net.Socket();
mysocket2.connect(new InetSocketAddress(hostaddress,80));
System.out.println("Socket opened to " + hostaddress + "\n");
String file=url_of_file.getFile();
System.out.println(" file = "+file);
os = mysocket2.getOutputStream();
String headRequest = "HEAD " +url_of_file+" HTTP/1.1\r\n"
+ "Host: "+ hostaddress +"\r\n\r\n";
os.write(headRequest.getBytes());
in = mysocket2.getInputStream();
reader= new BufferedReader(new InputStreamReader(in));
String contlength="Content-Length:";
// 1. Read the response header from server separately beforehand.
String response;
Totalsize = 0;
do{
response = reader.readLine();
if(response.indexOf("Content-Length") > -1)
{
Totalsize = Integer.parseInt(response.substring(response.indexOf(' ')+1));
response = null;
}
}while(response != null);
System.out.println(" cont_lentht ##### == "+Totalsize);
} catch (IOException ex) {
Logger.getLogger(Proxytesting.class.getName()).log(Level.SEVERE, null, ex);
}
The error I get is:
Unknown host exception at for code [ mysocket2.connect(
new InetSocketAddress(hostaddress,80));]

You are making things very hard for yourself. Use HttpURLConnection to connect through the proxy:
HttpConnection conn = (HttpConnection) url_of_file.openConnection(proxy);
conn.setRequestMethod("HEAD");
Totalsize = conn.getContentLength();
There are other HTTP clients which do a better job, but you should not create your own unless existing clients don't do what you need!

Thanks for the clues in comments. I found the solution to the problem. There was a bug in the code I was constructing InetSocketAddress twice using a wrong port. The complete working code is below.
public class Proxytesting {
private static OutputStream os;
private static InputStream in;
private static BufferedReader reader;
private static int Totalsize;
public static void main(String[] args) {
try {
URL url_of_file=new URL("http://www.stockvault.net/data/s/124348.jpg");
String hostaddress=url_of_file.getHost();
////////////////////for proxy server ///////////////////
String textip="172.16.4.7";
InetAddress host=InetAddress.getByName(textip);
System.out.println(host);
int port=1117;
SocketAddress ad=new InetSocketAddress(host, 1117);
Proxy proxy = new Proxy(Proxy.Type.SOCKS, ad);
Socket mysocket2 = new java.net.Socket();
mysocket2.connect(ad);
System.out.println("Socket opened to " + hostaddress + "\n");
String file=url_of_file.getFile();
System.out.println(" file = "+file);
os = mysocket2.getOutputStream();
String headRequest = "HEAD " +url_of_file+" HTTP/1.1\r\n"
+ "Host: "+ hostaddress +"\r\n\r\n";
os.write(headRequest.getBytes());
in = mysocket2.getInputStream();
reader= new BufferedReader(new InputStreamReader(in));
String contlength="Content-Length:";
// 1. Read the response header from server separately beforehand.
String response;
Totalsize = 0;
do{
response = reader.readLine();
if(response.indexOf("Content-Length") > -1)
{
Totalsize = Integer.parseInt(response.substring(response.indexOf(' ')+1));
response = null;
}
}while(response != null);
System.out.println(" cont_lentht ##### == "+Totalsize);
} catch (IOException ex) {
Logger.getLogger(Proxytesting.class.getName()).log(Level.SEVERE, null, ex);
}

Related

Exception : java.net.MalformedURLException: no protocol: /setwindowsagentaddr

I want to develop a HTTP Proxy ,
The code is here ;
When I run my code , I get this exception :
Started on: 9999
request for : /setwindowsagentaddr
Encountered exception: java.net.MalformedURLException: no protocol: /setwindowsagentaddr
package proxy;
import java.net.*;
import java.io.*;
public static void main(String[] args) throws IOException {
ServerSocket serverSocket = null;
boolean listenning = true;
// String host="192.168.1.10";
int port = 9999;
try{
port = Integer.parseInt(args[0]);
}catch(Exception e){
}
try{
serverSocket = new ServerSocket(port);
System.out.println("Started on: " + port);
}catch(Exception e){
// System.err.println("Could not listen on port: " + args[0]);
System.exit(0);
}
while(listenning){
new ProxyThread(serverSocket.accept()).start();
}
serverSocket.close();
}
}
and the ProxyThread here :
public class ProxyThread extends Thread {
private Socket socket = null;
private static final int BUFFER_SIZE = 32768;
public ProxyThread(Socket socket){
super("Proxy Thread");
this.socket=socket;
}
public void run(){
try {
DataOutputStream out = new DataOutputStream(socket.getOutputStream());
BufferedReader in = new BufferedReader(new InputStreamReader(socket.getInputStream()));
String inputLine , outputLine;
int cnt = 0 ;
String urlToCall="";
//get request from client
// socket.getPort();
while((inputLine=in.readLine()) != null){
try{
StringTokenizer tok = new StringTokenizer(inputLine);
tok.nextToken();
}catch(Exception e){
break;
}
///parse the first line of the request to get url
if(cnt==0){
String [] tokens = inputLine.split(" ");
urlToCall = tokens[1];
System.out.println("request for : "+ urlToCall);
}
cnt++;
}
BufferedReader rd = null;
try{
//System.out.println("sending request
//to real server for url: "
// + urlToCall);
///////////////////////////////////
//begin send request to server, get response from server
URL url = new URL(urlToCall);
URLConnection conn = url.openConnection();
conn.setDoInput(true);
//not doing http post
conn.setDoOutput(false);
System.out.println("Type is : "+ conn.getContentType());
System.out.println("length is : "+ conn.getContentLength());
System.out.println("allow user interaction :"+ conn.getAllowUserInteraction());
System.out.println("content encoding : "+ conn.getContentEncoding());
System.out.println("type is : "+conn.getContentType());
// Get the response
InputStream is = null;
HttpURLConnection huc = (HttpURLConnection) conn;
if (conn.getContentLength() > 0) {
try {
is = conn.getInputStream();
rd = new BufferedReader(new InputStreamReader(is));
} catch (IOException ioe) {
System.out.println(
"********* IO EXCEPTION **********: " + ioe);
}
}
//end send request to server, get response from server
//begin send response to client
byte [] by = new byte[BUFFER_SIZE];
int index = is.read(by,0,BUFFER_SIZE);
while ( index != -1 )
{
out.write( by, 0, index );
index = is.read( by, 0, BUFFER_SIZE );
}
out.flush();
//end send response to client
}catch(Exception e){
//can redirect this to error log
System.err.println("Encountered exception: " + e);
//encountered error - just send nothing back, so
//processing can continue
out.writeBytes("");
}
//close out all resources
if (rd != null) {
rd.close();
}
if (out != null) {
out.close();
}
if (in != null) {
in.close();
}
if (socket != null) {
socket.close();
}
} catch (Exception e) {
e.printStackTrace();
}
}
How can I fix this exceptions?
So the error isn't lying, /setwindowsagentaddr isn't a valid url. How would it know what protocol to use?
Try using something like http://localhost:8080/setwindowsagentaddr

What is run() function doing in ProxyThread class if is not called anywhere?

This is the class containing the main() method:
public class MultithreadedProxyServer {
public static void main(String[] args) throws IOException {
ServerSocket serverSocket = null;
boolean listening = true;
int port = 10000; //default
try {
port = Integer.parseInt(args[0]);
} catch (Exception e) {
//ignore me
System.out.println("gnore");
}
try {
serverSocket = new ServerSocket(port);
System.out.println("Started on: " + port);
} catch (IOException e) {
System.err.println("Could not listen on port: " + args[0]);
System.exit(-1);
}
while (listening) {
new ProxyThread(serverSocket.accept()).start();
}
serverSocket.close();
}
}
And this is the ProxyThread class:
public class ProxyThread extends Thread {
private Socket socket = null;
private static final int BUFFER_SIZE = 32768;
public ProxyThread(Socket socket) {
super("ProxyThread");
this.socket = socket; //initialzed my parent before you initalize me
}
public void run() {
//get input from user
//send request to server
//get response from server
//send response to user
System.out.println("run");
try {
DataOutputStream out =
new DataOutputStream(socket.getOutputStream());
BufferedReader in = new BufferedReader(
new InputStreamReader(socket.getInputStream()));
String inputLine, outputLine;
int cnt = 0;
String urlToCall = "";
///////////////////////////////////
//begin get request from client
while ((inputLine = in.readLine()) != null) {
try {
StringTokenizer tok = new StringTokenizer(inputLine);
tok.nextToken();
} catch (Exception e) {
System.out.println("break");
break;
}
//parse the first line of the request to find the url
if (cnt == 0) {
String[] tokens = inputLine.split(" ");
urlToCall = tokens[1];
//can redirect this to output log
System.out.println("Request for : " + urlToCall);
}
cnt++;
}
//end get request from client
///////////////////////////////////
BufferedReader rd = null;
try {
//System.out.println("sending request
//to real server for url: "
// + urlToCall);
///////////////////////////////////
//begin send request to server, get response from server
URL url = new URL(urlToCall);
URLConnection conn = url.openConnection();
conn.setDoInput(true);
//not doing HTTP posts
conn.setDoOutput(false);
//System.out.println("Type is: "
//+ conn.getContentType());
//System.out.println("content length: "
//+ conn.getContentLength());
//System.out.println("allowed user interaction: "
//+ conn.getAllowUserInteraction());
//System.out.println("content encoding: "
//+ conn.getContentEncoding());
//System.out.println("content type: "
//+ conn.getContentType());
// Get the response
InputStream is = null;
HttpURLConnection huc = (HttpURLConnection)conn;
if (conn.getContentLength() > 0) {
is = conn.getInputStream();
rd = new BufferedReader(new InputStreamReader(is));
}
//end send request to server, get response from server
///////////////////////////////////
///////////////////////////////////
//begin send response to client
byte by[] = new byte[ BUFFER_SIZE ];
int index = is.read( by, 0, BUFFER_SIZE );
while ( index != -1 )
{
out.write( by, 0, index );
index = is.read( by, 0, BUFFER_SIZE );
}
out.flush();
//end send response to client
///////////////////////////////////
} catch (Exception e) {
//can redirect this to error log
System.err.println("Encountered exception: " + e);
//encountered error - just send nothing back, so
//processing can continue
out.writeBytes("");
}
//close out all resources
if (rd != null) {
rd.close();
}
if (out != null) {
out.close();
}
if (in != null) {
in.close();
}
if (socket != null) {
socket.close();
}
} catch (IOException e) {
e.printStackTrace();
}
}
}
I have copy-pasted the above code from the internet, however I am having difficulties running it.
To answer the question from the post title, the run() method from ProxyThread class is called by JVM, after the thread has been started new ProxyThread(serverSocket.accept()).start(); and it usually contains the actual work that a thread should performed (in this case, it handles whatever the server socket receives and it accepts a connection from a client).
The moment when JVM calls run() method cannot be controlled by the programmer, but is after the thread has been started.
run() method is never called explicitly by the programmer.

Java TCP byteArray transfering using buffer and threading

So basically what I want to do is: Create a very simple multithreaded TCP server that can connect to several clients at once. This using threads and transferring messages through Byte[] and returning an echo of the message.
I have never touched anything related to server programming or TCP before, so I expect to have made a lot of mistakes. I am open for improvement and suggestions.
I made a simple Server class:
public class TCPEchoServer {
public static final int SERVERPORT = 4950;
public static void main(String[] args) throws IOException {
ServerSocket serverSocket = new ServerSocket(SERVERPORT);
while (true) {
Socket clientSocket = serverSocket.accept();
Runnable connectionHandler = new TCPConnectionHandler(clientSocket);
new Thread(connectionHandler).start();
}
}
}
And the connection handler class:
public class TCPConnectionHandler implements Runnable {
private final Socket clientSocket;
private int msgLength = 0;
private byte[] data;
public TCPConnectionHandler(Socket clientSocket) {
this.clientSocket = clientSocket;
}
#Override
public void run() {
try {
BufferedReader inFromClient = new BufferedReader(new InputStreamReader(clientSocket.getInputStream()));
DataOutputStream outToClient = new DataOutputStream(clientSocket.getOutputStream());
InputStream in = clientSocket.getInputStream();
DataInputStream dis = new DataInputStream(in);
msgLength = dis.readInt();
data = new byte[msgLength];
if (msgLength > 0) {
dis.readFully(data);
}
String message = inFromClient.readLine();
System.out.println("Message recieved: " + message);
outToClient.writeBytes(String.valueOf(data));
clientSocket.close();
}
catch (IOException e) {
System.out.printf("Could not listen on port: " + clientSocket.getLocalPort());
}
}
}
And the Client class:
public class TCPEchoClient {
public static final int MYPORT = 0;
public static int BUFFSIZE = 0;
public static Socket socket;
public static final String MSG = "An Echo Message! LOL";
public static String RETURNMSG = "";
public static final byte[] messageByteArr = MSG.getBytes(Charset.forName("UTF-8"));
private static final Pattern PATTERN = Pattern.compile(
"^(([01]?\\d\\d?|2[0-4]\\d|25[0-5])\\.){3}([01]?\\d\\d?|2[0-4]\\d|25[0-5])$");
public static void main(String[] args) throws IOException, InterruptedException {
if (args.length != 4) {
System.err.printf("ERROR: The EchoClient expects 4 parameter inputs:");
System.out.printf("IP address, Port number, message rate (msg/second).");
System.exit(1);
}
if (!isValidIP(args[0])) {
System.out.printf("ERROR: The entered IP address is not a valid IPv4 address.");
System.out.printf("Please enter a valid IPv4 address as the first argument.");
System.exit(1);
}
if (Integer.parseInt(args[1]) < 0 || Integer.parseInt(args[1]) > 65535) { //If the portnumber is negative or bigger than the highest portnumber (unsigned 16-bit integer)
System.out.printf("ERROR: The chosen portnumber is outside the available range.");
System.out.printf("Expected portnumbers: 0-65535");
System.exit(1);
}
if (Integer.parseInt(args[3]) < messageByteArr.length) {
System.out.println("Buffer size can not be smaller than the message size.");
System.out.println("Current message size: " + messageByteArr.length);
System.exit(1);
}
BUFFSIZE = Integer.parseInt(args[3]);
byte[] buf = new byte[BUFFSIZE];
DataOutputStream outToServer = null;
BufferedReader serverEcho = null;
try {
socket = new Socket(args[0], Integer.parseInt(args[1]));
outToServer = new DataOutputStream(socket.getOutputStream());
serverEcho = new BufferedReader(new InputStreamReader(socket.getInputStream()));
} catch (UnknownHostException e) {
System.out.println("Unknown host address: " + args[0]);
System.exit(1);
} catch (IOException e) {
System.out.println("Could not access port " + Integer.parseInt(args[1]));
System.exit(1);
}
int msgLength = 0;
int msgStart = 0;
if (msgLength < 0) {
throw new IllegalArgumentException("Negative length not allowed.");
}
if (msgStart < 0 || msgStart >= messageByteArr.length) {
throw new IndexOutOfBoundsException("Out of bounds: " + msgStart);
}
for (int i = 1; i <= Integer.parseInt(args[2]); i++) {
outToServer.writeInt(msgLength);
if (msgLength > 0) {
outToServer.write(messageByteArr, msgStart, msgLength);
System.out.println("Message sent: " + MSG);
}
RETURNMSG = serverEcho.readLine();
System.out.println("ECHO MESSAGE: " + RETURNMSG);
}
socket.close();
}
private static boolean isValidIP(final String ip) {
return PATTERN.matcher(ip).matches();
}
}
I ran into a problem just now as well, the print outs worked before on the client and sever, but now when a message is sent. Nothing happens at all.
My main question is how I can incorporate a buffer and use it when sending and receiving messages.
You have a loop in the client that will wait args[2] times the RETURNMSG, the server will send this message only once. The RETURNMSG reading code should be outside (after) the for loop.
You should flush the buffer once you've finished writing in it.
This should be done in both client and server, since your client will wait the RETURNMSG forever depending how your protocol will evolve in the future.

How do I connect to the server socket using the ip address and port number? (client is running on a different machine than server)

Client program
public class client implements Runnable {
protected static String server_IP = "141.117.57.42";
private static final int server_Port = 5555 ;
protected static String client_IP ;
public static void main(String[] args) throws IOException{
final String host = "localhost";
int init = 0 ;
try {
InetAddress iAddress = InetAddress.getLocalHost();
client_IP = iAddress.getHostAddress();
System.out.println("Current IP address : " +client_IP);
} catch (UnknownHostException e) {
}
try {System.out.println("hello1");
Socket socket = new Socket(server_IP,server_Port);
System.out.println("hello3");
init = initialize(socket);
}catch (SocketException e) {
System.out.println("Error: Unable to connect to server port ");
}
if (init == 0 ){
System.out.println("error: Failed to initialize ");
System.exit(0);
}
//Thread init_Thread = new Thread();
}
private static int initialize(Socket socket ) throws IOException{
System.out.println("hello");
int rt_value = 0 ;
OutputStream os = socket.getOutputStream();
BufferedReader br = new BufferedReader(new InputStreamReader(socket.getInputStream()));
PrintWriter pw = new PrintWriter(os, true);
System.out.println("server: " + br.readLine());
pw.println("192.343.34.321");
// BufferedReader userInputBR = new BufferedReader(new InputStreamReader(System.in));
//String userInput = userInputBR.readLine();
//out.println(userInput);
socket.close();
return rt_value = 1 ;
}
public void run(){
}
}
server side program
public class server {
protected static String server_IP ;
public static void main(String[] args) throws IOException {
int server_Port = 5555 ;
try {
InetAddress iAddress = InetAddress.getLocalHost();
server_IP = iAddress.getHostAddress();
System.out.println("Server IP address : " +server_IP);
} catch (UnknownHostException e) {
}
ServerSocket serverSocket = new ServerSocket(server_Port);
while (true) {
Socket socket = serverSocket.accept();
OutputStream os = socket.getOutputStream();
PrintWriter pw = new PrintWriter(os, true);
InputStreamReader isr = new InputStreamReader(socket.getInputStream());
pw.println("Connection confirmed ");
BufferedReader br = new BufferedReader(isr);
String str = br.readLine();
pw.println("your ip address is " + str);
pw.close();
//socket.close();
//System.out.println("Just said hello to:" + str);
}
How do I connect to the server socket using the ip address and port number (client is running on a different machine than server).
When I change the server_IP in client to "local host", it works perfectly.
To connect in your code you use:
Socket socket = new Socket(server_IP,server_Port);
So you could use:
Socket socket = new Socket("192.168.1.4", 5555);
It looks like you have this in your code so I'm not sure what problem you're having.
Don't forget that you have to setup your router to forward ports if it is located outside of your local network.
http://www.wikihow.com/Set-Up-Port-Forwarding-on-a-Router
Don't forget that if you are running a firewall, this can also interfere with the connection.
Update /etc/hosts
Add following line
127.0.1.1 192.168.10.109

Java Peer-to-Peer networking application - homework

I'm creating a p2p application in Java for file sharing. Each peer node will be running on my machine on a different port and listen for a request. but the problem I'm running into is when an instance of PeerNode is created my code runs into an infinite loop. Following is my code for PeerNode. Is this how I should create each node and have them listen for incoming requests?
Following code represents one peer node:
public class PeerNode
{
private int port;
private ArrayList<PeerNode> contacts;
PeerNode preNode;
PeerNode postNode;
private String directoryLocation = "";
PeerNode(int port)
{
this.port = port;
this.setDirectoryLocation( port+"");
startClientServer( port );
}
private void sendRequest(String fileName, String host, int port) throws UnknownHostException, IOException
{
Socket socket = new Socket(host, port);//machine name, port number
PrintWriter out = new PrintWriter( socket.getOutputStream(), true );
out.println(fileName);
out.close();
socket.close();
}
private void startClientServer( int portNum )
{
try
{
// Establish the listen socket.
ServerSocket server = new ServerSocket( 0 );
System.out.println("listening on port " + server.getLocalPort());
while( true )
{
// Listen for a TCP connection request.
Socket connection = server.accept();
// Construct an object to process the HTTP request message.
HttpRequestHandler request = new HttpRequestHandler( connection );
// Create a new thread to process the request.
Thread thread = new Thread(request);
// Start the thread.
thread.start();
System.out.println("Thread started for "+ portNum);
}
}
catch (Exception e)
{
// TODO Auto-generated catch block
e.printStackTrace();
}
}
}
And following class creates all the nodes and connects them:
public class MasterClientServer
{
public static void main( String [] args )
{
int count = 10;
ArrayList<PeerNode> arrayOfNodes = createNodes( count );
}
public static ArrayList<PeerNode> createNodes( int count)
{
System.out.println("Creating a network of "+ count + " nodes...");
ArrayList< PeerNode > arrayOfNodes = new ArrayList<PeerNode>();
for( int i =1 ; i<=count; i++)
{
arrayOfNodes.add( new PeerNode( 0 ) ); //providing 0, will take any free node
}
return arrayOfNodes;
}
}
public class HttpRequestHandler implements Runnable
{
final static String CRLF = "\r\n";
Socket socket;
public HttpRequestHandler(Socket socket) throws Exception
{
this.socket = socket;
}
#Override
public void run()
{
try
{
processRequest();
}
catch (Exception e)
{
System.out.println(e);
}
}
/*
* Gets a request from another node.
* Sends the file to the node if available.
*/
private void processRequest() throws Exception
{
/*DataOutputStream os = new DataOutputStream(socket.getOutputStream());
InputStream is = socket.getInputStream();
BufferedReader br = new BufferedReader(new InputStreamReader(is));
// Get the request line of the HTTP request message.
String requestLine = br.readLine();
// Extract the filename from the request line.
// In Get request, the second token is the fie name
String[] tokens = requestLine.split(" ");
String fileName = tokens[1];
// Prepend a "." so that file request is within the current directory.
fileName = "." + fileName;
// Open the requested file.
FileInputStream fis = null;
boolean fileExists = true;
try
{
fis = new FileInputStream(fileName);
}
catch (FileNotFoundException e)
{
fileExists = false;
}
// construct the response Message
// Construct the response message.
String statusLine = null;
String contentTypeLine = null;
String entityBody = null;
if (fileExists)
{
statusLine = "HTTP/1.1 200 OK" + CRLF;
contentTypeLine = "Content-Type: " + contentType(fileName) + CRLF;
}
else
{
statusLine = "HTTP/1.1 404 Not Found" + CRLF;
contentTypeLine = "Content-Type: text/html" + CRLF;
entityBody = "<HTML><HEAD><TITLE>404 Not Found</TITLE></HEAD><BODY>Error 404: Page Not Found</BODY></HTML>";
}
// Send the status line.
os.writeBytes(statusLine);
// Send the content type line.
os.writeBytes(contentTypeLine);
// Send a blank line to indicate the end of the header lines.
os.writeBytes(CRLF);
// Send the entity body.
if (fileExists) {
sendBytes(fis, os);
fis.close();
} else {
os.writeBytes(entityBody);
}
// Close streams and socket.
os.close();
br.close();
socket.close();
}
private static void sendBytes(FileInputStream fis, OutputStream os)
throws Exception
{
// Construct a 1K buffer to hold bytes on their way to the socket.
byte[] buffer = new byte[1024];
int bytes = 0;
// Copy requested file into the socket's output stream.
while ((bytes = fis.read(buffer)) != -1) {
os.write(buffer, 0, bytes);
}*/
}
private static String contentType(String fileName)
{
if (fileName.endsWith(".htm") || fileName.endsWith(".html"))
{
return "text/html";
}
if (fileName.endsWith(".jpg") || fileName.endsWith(".jpeg"))
{
return "image/jpeg";
}
if (fileName.endsWith(".gif")) {
return "image/gif";
}
if (fileName.endsWith(".ram") || fileName.endsWith(".ra"))
{
return "audio/x-pn-realaudio";
}
return "application/octet-stream";
}
}
Your PeerNode constructor never returns since it is busy accepting new connections. Hence your loop in createNodes only creates the first PeerNode instance. You can solve this by calling startClientServer in a new thread:
new Thread(new Runnable() {
public void run() {
startClientServer( port );
}
}.start();

Categories

Resources