This week's giveaway is in the Android forum.
We're giving away four copies of Android Security Essentials Live Lessons and have Godfrey Nolan on-line!
See this thread for details.
The moose likes Sockets and Internet Protocols and the fly likes Socket push.. Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Java » Sockets and Internet Protocols
Bookmark "Socket push.." Watch "Socket push.." New topic
Author

Socket push..

ericcjohnson
Greenhorn

Joined: Jan 18, 2002
Posts: 2
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
Laudney Ren
Ranch Hand

Joined: Jan 06, 2002
Posts: 111
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 "
ericcjohnson
Greenhorn

Joined: Jan 18, 2002
Posts: 2
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!
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Socket push..
 
Similar Threads
chat program
FilesDownload from FTP
How to make a Serverless java LAN Chat application with a user list
URL and mapping to servlets
Storing Socket object in database