Jump to content

Making thread to a server socket


Tikvesa

Recommended Posts

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
Link to comment
Share on other sites

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

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Recently Browsing   0 members

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