This week's book giveaway is in the OCMJEA forum. We're giving away four copies of OCM Java EE 6 Enterprise Architect Exam Guide and have Paul Allen & Joseph Bambara on-line! See this thread for details.
I have an application that keeps an open socket between a servlet and flash 5. I am trying to write some code that will let a user attach a file in my flash program, upload it to the server, and then notify the user of the progress... my problem is i cant upload a file directly using flash, so im popping up a new html window in a browser, attaching the file, and posting it to the same servlet which saves it to the server...that works fine...what i need to know tho..is how do i get info back to the user through the socket thats connected between the same servlet and their flash client? is there a way to push out from my servlet to the outputstream on a specific port? if i know what port the user is connected too? is that the right way to do it? any help would be appreciated! thanks, eric
Once your servlet gets the socket when returns from accept(), don't call the socket's close() and write to that socket by using socket's getOutputStream. That way, the socket is retained. BTW, if you want your servlet to connect to a specific port on the client, the client now should be the server while the servlet becomes the client. Roles interchange.
" Veni, vidi, vici "<br />" I came, I saw, I conquered "
Joined: Jan 18, 2002
thanks for the input. i actually will have several clients connecting and a thread spins off for each of them. i was looking for a pointer on how to get to each thread? should i be looking at the thread class? does it have a list of currently active threads that i can access by port number or name or something? i saw something about thread groups and names...is that the right direction? basically i need the equivalent of a private message in chatting... a request comes in and i figure out who i need to send the message to and send it through that threads output stream. make sense? am i going in the right direction by looking into thread output streams? thanks!