Jump to content

Making thread to a server socket


Recommended Posts

Posted (edited)
7 hours ago, Gunman said:

Need a better description of the issue you're having

So i implemented this into my script (its part of the script that runes in loop):

public class Test {

    public static void main(String[] args) throws InterruptedException {
        Server server = new Server(50000);
        server.listen();

        server.write("Hello peasant");
    }
}

And it works as intended for the first request. Then it goes to the rest of the script but when it comes back to that part and when it need to listen for a new request again it just ignores whole thing and it doesnt listen for a new request.

I found on a web to add thread into all this but i tried all day today and i dont know how

Edited by Tikvesa
Posted
19 hours ago, Tikvesa said:

So i implemented this into my script (its part of the script that runes in loop):

public class Test {

    public static void main(String[] args) throws InterruptedException {
        Server server = new Server(50000);
        server.listen();

        server.write("Hello peasant");
    }
}

And it works as intended for the first request. Then it goes to the rest of the script but when it comes back to that part and when it need to listen for a new request again it just ignores whole thing and it doesnt listen for a new request.

I found on a web to add thread into all this but i tried all day today and i dont know how

You need to look up a simple java client and server socket tutorial and then look up multithreading for it as well

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...