How to Read File a remotely using TCP/ip Sockets in java

A

avdhesh.yadav

Hi all

let me first explain secnerio.

Actually i have to write a multithreaded program.
In this program i have to read files remotely using TCP sockets...
Everytime New file comes i have to create a new Socket and accept and
read the file.


and then after rading it i have to send it to a a client..

Thing is that file is Remotly located..
first i have to connect to that server ad then read file and send it
client..where we done processing ..

i m thinking two things ..
in one case i crrate a single socket and read files through this socket
and send it to cleint..
other is creat separate sockets and read files and then send it to
client..


Which option is correct and how i program this..

Thanks in advace
Avdhesh
 
J

jcsnippets.atspace.com

i m thinking two things ..
in one case i crrate a single socket and read files through this socket
and send it to cleint..
other is creat separate sockets and read files and then send it to
client..


Which option is correct and how i program this..

I'm afraid that I do not fully understand what you are trying to do. Like in
most cases, there are several solutions possible, and it all depends on what
you are exactly trying to do to choose the best option.

If you're downloading a file from a server, processing it on another machine
and then sending it to a third machine (the client), I would definitely
separate those two processes.

As a result of that, you'd create one connection (socket) to the server, and
another to the client.

Best regards,

JayCee
 
Joined
Jun 26, 2006
Messages
1
Reaction score
0
Hi,
I have to do something similar.I am completly new to sockets so i do not know much how they work and i am given a task to complete in 3 days

i need to transfer files to a remotemachine and read files from the remotemachine i am looking at sockets to do this.I created a server class and client class and these are the following question i have

should the server class be installed on the remote machine ?
how to make the server class run from my machine
If i want to transfer 2 files to a remote machine how can i specify the names of the files to the server.

Can somebody please answer the questions.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,982
Messages
2,570,190
Members
46,736
Latest member
zacharyharris

Latest Threads

Top