im trying to write a client server program, in my program, each turn, client sends two String to the server, first one is a web address and second one is some random information about user.but when the url address arrives at server, i get this exception:
Exception in thread "main" java.io.IOException: Server returned HTTP response code: 403 for URL: http://www.google.com.hk/search?hl=en&source=hp&q=java&gbv=2
    at sun.net.www.protocol.http.HttpURLConnection.getInputStream(HttpURLConnection.java:1245)
    at java.net.URL.openStream(URL.java:1009)
    at server.Server.processClient(Dom.java:124)
    at server.Server.run(Dom.java:90)
    at server.Server.main(Dom.java:155)
Java Result: 1
but i have no idea why getting a forbidden response.
Client side
              private static BufferedWriter toServer;
....
  public void progressUpdated(NavigatorProgressEvent npe) {
            Matcher matcher = pattern.matcher (npe.getUrl().toString());
            if (matcher.matches ())
                        {
                System.out.println(npe.getUrl());
                        toServer.println(npe.getUrl().toString());
                                }
Server side
...
   url = new URL(fromClient.readLine());
....
 
    