how to handle PORT - - Multithreaded Client UDP
Hi everybody,
this is my first post, I am a beginner to Java and I really need your help.
I am implementing a multithreaded server , that serves more clients also multithreaded with UDP Socket.They connect to each other, and they work fine when there are just one client/two different clients(which means two different files).
But :
When I try to connect 2 clients with the same code, they connect to the same port, which is the one I set in the piece of code afterwards.
so this is my question: how to connect multithreaded clients to the server in different ports?
Here is the piece of code:
class WorkerThread extends Thread{
DatagramSocket socket = null;
int bufLength = 256;
int port=9981;
....
}
Thank you in advance!