So currently i am connecting to the server side via IP address, but i want it to not having the need to specify IP-address of the server computer. Anyhow i can just detect that a current serversocket is open on the network and connect to that from the clientside?
This is what i write for the server:
server = new ServerSocket(1234,100);
and on the client side:
connection = new Socket(InetAddress.getByName("someIpAddress"),1234);
If the server is always on the same network, you can always use UDP broadcasting to detect a service.
The server listens for the broadcasts, and then replies thereby sending its IP address.
If the server and client are on different networks, with at lease one router in between, then there is no way to "detect" the server from the client.