i have a lot of errors

client server using java

Page 1 of 1

7 Replies - 886 Views - Last Post: 20 July 2007 - 11:07 AM Rate Topic: -----

#1 scarecrowfeild  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 33
  • Joined: 14-July 07

i have a lot of errors

Posted 20 July 2007 - 03:30 AM

someone plz help me with the errors.can't run it since it has a lot of syntax error.here are the code.

import java.net.*;
import java.io.*;

public class Server2{
private ServerSocket server;
private Socket connection;
private BufferedReader input;
private BufferedWriter output;

public Server2(){
try{
server=new ServerSocket(5000,10);
}
catch(IOException exception)
{
exception.printStackTrace();
System.exit(0);
}
}
public void runServer()
{
try
{connection=server.accept();
output=new BufferedWriter(new OutputStreamWriter(connection.getOutputStream()));
output.flush();
input=new BufferedReader(new InputStreamReader(connection.getInputStream()));
File file=new File(input.readLine());
String result;
if(file.exists()){
BufferedReader fileInput=new BufferedReader(new InputStreamReader(new FileInputStream(file)));
output.write("The file is :\n",0,13);
output.flush();
result=fileInput.readLine();

while(result!=null){
output.write(result+'\n',0,result.length()+1);
output.flush();
result=fileInput.readLine();
}
}
else{result=file.getName()+"does not exist\n";
output.write(result,0,result.length());
output.flush();
}
output.close();
input.close();
connection.close();
}
catch(IOException ioException){
System.err.println("IOException has occurred!");
ioException.printStackTrace();
System.exit(0);
}
}public static void main(String[]arg){
Server2 application=new Server2();
application.runServer();
}
}

Is This A Good Question/Topic? 0
  • +

Replies To: i have a lot of errors

#2 PennyBoki  Icon User is offline

  • system("revolution");
  • member icon

Reputation: 53
  • View blog
  • Posts: 2,334
  • Joined: 11-December 06

Re: i have a lot of errors

Posted 20 July 2007 - 04:05 AM

Hi, I compiled it myself and there were no syntax errors
Was This Post Helpful? 0
  • +
  • -

#3 Amadeus  Icon User is offline

  • g+ + -o drink whiskey.cpp
  • member icon

Reputation: 248
  • View blog
  • Posts: 13,506
  • Joined: 12-July 02

Re: i have a lot of errors

Posted 20 July 2007 - 05:39 AM

What errors were you getting?
Was This Post Helpful? 0
  • +
  • -

#4 scarecrowfeild  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 33
  • Joined: 14-July 07

Re: i have a lot of errors

Posted 20 July 2007 - 06:56 AM

i don't really get this.but i compile it again just now(nothing is change)...and it has no error.Is there any problem with my computer?

This post has been edited by scarecrowfeild: 20 July 2007 - 07:03 AM

Was This Post Helpful? 0
  • +
  • -

#5 PennyBoki  Icon User is offline

  • system("revolution");
  • member icon

Reputation: 53
  • View blog
  • Posts: 2,334
  • Joined: 11-December 06

Re: i have a lot of errors

Posted 20 July 2007 - 07:18 AM

Compilers work in a mysterious ways ;)
Was This Post Helpful? 0
  • +
  • -

#6 scarecrowfeild  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 33
  • Joined: 14-July 07

Re: i have a lot of errors

Posted 20 July 2007 - 09:22 AM

by the way thanks.I am bit panic since i have to pass it tomorrow.anyone has idea how to link java with any database?
Was This Post Helpful? 0
  • +
  • -

#7 PennyBoki  Icon User is offline

  • system("revolution");
  • member icon

Reputation: 53
  • View blog
  • Posts: 2,334
  • Joined: 11-December 06

Re: i have a lot of errors

Posted 20 July 2007 - 10:27 AM

A Link to a tutorial

http://www.dreaminco...wtopic21364.htm
Was This Post Helpful? 0
  • +
  • -

#8 scarecrowfeild  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 33
  • Joined: 14-July 07

Re: i have a lot of errors

Posted 20 July 2007 - 11:07 AM

thanks again
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1