Posted By:
Syed_Abbas
Posted On:
Thursday, June 14, 2001 03:12 PM
I am trying to read in the contents of a url http://213.107.33.171/scripts/mqinterconnect.exe?link=map&city=london&country=uk And failing! The code is :- String hostname = "213.107.33.171"; int port = 80 ; String filename = "/scripts/mqinterconnect.exe?link=map&city=london&country=uk "; String record = null; Socket s = new Socket(hostname, port); int recCount = 0; try { InputStream sin = s.getInputStream(); BufferedReader fromServer = new BufferedReader(new InputStreamReader(sin)); OutputStream sout = s.getOutputStream(); PrintWriter toServer = new PrintWriter(new Outp
More>>
I am trying to read in the contents of a url
http://213.107.33.171/scripts/mqinterconnect.exe?link=map&city=london&country=uk
And failing!
The code is :-
String hostname = "213.107.33.171";
int port = 80 ;
String filename = "/scripts/mqinterconnect.exe?link=map&city=london&country=uk
";
String record = null;
Socket s = new Socket(hostname, port);
int recCount = 0;
try {
InputStream sin = s.getInputStream();
BufferedReader fromServer = new BufferedReader(new InputStreamReader(sin));
OutputStream sout = s.getOutputStream();
PrintWriter toServer = new PrintWriter(new OutputStreamWriter(sout));
out.print("Get" + filename + "http:///
");
toServer.println("Get " + filename + " http:///
");
record = new String();
while ((record = fromServer.readLine()) != null) {
recCount++;
out.println(recCount);
} toServer.close();
fromServer.close();
s.close();
Please help!
<<Less