Results 1 to 2 of 2
- 03-07-2010, 05:59 AM #1
Member
- Join Date
- Mar 2010
- Posts
- 11
- Rep Power
- 0
Sending Text File --- Server-To-Client
I want to send file which is created at the server to the client and then read the file contents
Server
======
....
providerSocket = new ServerSocket(2004, 3);
System.out.println("Waiting for connection");
connection = providerSocket.accept();
...
KeyPair keyPair = KeyPairGenerator
.getInstance("RSA")
.generateKeyPair();
ServerPublicKey = keyPair.getPublic();
ServerPrivateKey = keyPair.getPrivate();
FileOutputStream fosSvrKU = new FileOutputStream("fosServerKU1.txt");
DataOutputStream dosSvrKU = new DataOutputStream(fosSvrKU);
dosSvrKU.writeUTF(ServerPublicKey.toString());
dosSvrKU.flush();
dosSvrKU.close();
Client
======
....
clientSocket = new Socket("localhost",2004);
????
- 03-08-2010, 03:45 PM #2
Senior Member
- Join Date
- Dec 2009
- Location
- Belgrade, Serbia
- Posts
- 364
- Rep Power
- 4
You have nice network tutorial on this forum on this topic
http://www.java-forums.org/java-tuto...amming-ii.html
Be sure you basic client/server socket comunication work
with simple message exchange
then move on to sending file.
Why are you using KeyPairs for this.
Are security issues important?
If not skip them for start.
Create unsecure solution first then move to security - it can be much complex than all this.
regards
Similar Threads
-
Sending a File from Server to Client and saving the file to Clients computer
By al_Marshy_1981 in forum NetworkingReplies: 8Last Post: 02-18-2010, 12:54 PM -
Sending image file over serversocket to browser client
By maheshsk in forum NetworkingReplies: 3Last Post: 12-10-2009, 03:49 PM -
how to send a file from server to client and client saves the file?
By KoolCancer in forum New To JavaReplies: 3Last Post: 07-29-2009, 04:52 AM -
Sending a .Doc file from client to a server through socket
By amita_k29 in forum NetworkingReplies: 1Last Post: 02-10-2009, 09:16 AM -
sending jar files from client to server?
By gobinathm in forum New To JavaReplies: 2Last Post: 11-13-2007, 05:12 AM


LinkBack URL
About LinkBacks
Reply With Quote
Bookmarks