Hello,
I have created a simple multithreaded chat application using Java sockets. When a new client connects a new server thread is created to handle communication with that client.
I also want to allow clients to transfer files from one computer to another.
I think there cannot be direct connection between two clients when using applets.
So server has to receive the file from one client and send it to other client.
1. But even then how connection between two clients can be opened.
Problem is using socket.getOutputStream() and socket.getInputStream() only one output/input stream is created, so file contents cannot be transferred using that input/output stream because that stream is used to receive and send chat messages and I want clients to continue sending and receiving messages when file is being transferred.
2. Can a server connect to client's computer to some other port (for sending file) if that client is already connected to the server for sending and receiving messages i.e if there is already a socket connection between client and server.
3. Can file be transferred by getting second input/output stream using socket.getInputStream() and socket.getOutputStream() again?
I have created a simple multithreaded chat application using Java sockets. When a new client connects a new server thread is created to handle communication with that client.
I also want to allow clients to transfer files from one computer to another.
I think there cannot be direct connection between two clients when using applets.
So server has to receive the file from one client and send it to other client.
1. But even then how connection between two clients can be opened.
Problem is using socket.getOutputStream() and socket.getInputStream() only one output/input stream is created, so file contents cannot be transferred using that input/output stream because that stream is used to receive and send chat messages and I want clients to continue sending and receiving messages when file is being transferred.
2. Can a server connect to client's computer to some other port (for sending file) if that client is already connected to the server for sending and receiving messages i.e if there is already a socket connection between client and server.
3. Can file be transferred by getting second input/output stream using socket.getInputStream() and socket.getOutputStream() again?