So i'm making a server socket I call the constructor to constuct the serversocket then call the getLocalPort method to get the local port but server.getLocalPort(); is throwing a null pointer exception and I can't figure out why i'm stumped. I'm sure its some dumb mistake but I just can't see it.
public SServer(int port) throws SocketException, IOException
{
ServerSocket server = new ServerSocket(port);
server.setReuseAddress(true);
}
public int getLocalPort() {
int port = server.getLocalPort();
return port;
}