Hear us Roar
Article:
 |
|
How Java Web Servers Work
|
| Subject: |
|
Error in first example |
| Date: |
|
2003-05-21 01:49:56 |
| From: |
|
anonymous2
|
|
|
|
Hi,
The Socket constructor used in the first example code snippet will cause the compiler to barf.
This is because the second parameter - written as "8080" - is passed as a String, whereas the constructor is expecting an int as the second parameter. Remove the quotes and that bit will work.
Also, if you're going to use this, don't forget to throw all the possible exceptions (UnknownHostException, IOException, InterruptedException).
Cheers,
Justin
|
|
| |