Naveed Anjum

Greenhorn
+ Follow
since Feb 10, 2004
Merit badge: grant badges
For More
Cows and Likes
Cows
Total received
0
In last 30 days
0
Total given
0
Likes
Total received
0
Received in last 30 days
0
Total given
0
Given in last 30 days
0
Forums and Threads
Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by Naveed Anjum

first of all thankz for ur reply actually i donot want to read or write file i just want that client send a request for a file to server and server then send this file to client with out open this file and the file size is 1 MB.i have both programmes for client and server........
20 years ago
i am executing a client server programme on a local PC and i want to send a file from server to client.For example i have a file on PC in directory c:\myfiles\naveed.txt i want to send this file from server to client.So plz tell me which command i will use.
20 years ago
import java.net.*;
import java.io.*;
import java.util.*;
public class Client1{
public static void main(String[] args){
String server="localhost";
int port=80;

try{
Socket socket=new Socket(server,port);
BufferedReader inputStream=new BufferedReader(new InputStreamReader(socket.getInputStream()));
PrintWriter outputStream=new PrintWriter(new OutputStreamWriter(socket.getOutputStream()),true);
outputStream.println("Hello");
System.out.println(inputStream.readLine());
socket.close();
Server s=new Server();
}
catch(ConnectException e){System.out.println(e);}
catch(UnknownHostException e){System.out.println(e);}
catch(IOException e){System.out.println(e);}

}
}
when i execute this programme i got an error message"java.net.ConnectionException:Connection refused:connect".Telll me whats the problem with this programme.
20 years ago
Hi,
i wrote a CLIENT program for Local PC so i got this Run Time message
"java.net.ConnectException: Connection refused: connect" I thik this message is due to port no. so plz tell me how i can get the LOCAL PC port...
20 years ago