For a class project, I have been developing a simple client/server application that can transmit a file of the clients choosing to a waiting server. The server then chooses where to save the file.
I want my server working with threads so it doesn't have terrible blocking waits.
My trouble is, I recieve the file (as a serialized object) in the thread, and I cant figure out how to sent it back to the server object, so it can be sent back to the GUI so that I can put it into the file chooser so it can be saved to the harddrive. *Sigh*
I don't understand threads very well, and got a feel for how they work from the Sun's examples.
Here is the call creating the thread (sun's page had no assignment in this example)
I don't have time to read all the code right now, but one thing that jumped out at me is that you're serializing the File and sending it to the server. Are you thinking that will send the file's contents? If so, back to the drawing board. You need to read the bytes from the file (using streams) and send them to the server, again using streams from TCP/IP sockets.
If that's not your intention, can you explain exactly what you want to send to the server?
Joined: Apr 16, 2005
>I don't have time to read all the code right now, Good. Don't bother, it's changed a great deal today, and the threads are now working.
>Are you thinking that will send the file's contents? Yes, I was. Once I hammered out the problems (and man were there problems) and everything was working, but I was ending up with crap for the result... I realized I was just basically sending a path to a file that didn't exist on the other end of the socket.
>read the bytes from the file (using streams) and send them to the server, >again using streams from TCP/IP sockets.
Yeah, still trying to figure this bit out, and could use some direction... but that's a post for the I/O forum and not the threads forum