Dynamic Java Socket server Port -
i asked build server client chat application dynamic ports allocation ,my problem can't retrieve dynamic port client class , tried several methods :static members ,singleton design patterns..but without success .is there method ? server constructor :
public serveur() throws ioexception{ listen=new serversocket(0); port=listen.getlocalport(); system.out.println("le serveur est demarre"); }
when acces variable port client class ,it returns next free port ,which incorrect ,please help!!
when access variable port client
eh? can't access variable port client. don't know is.
you have work out way server tell client port number is. you'll have broadcast or multicast server, or have clients broadcast or multicast requests it.
or use fixed port. it's easier.
Comments
Post a Comment