This week's book giveaway is in the OCPJP forum. We're giving away four copies of OCA/OCP Java SE 7 Programmer I & II Study Guide and have Kathy Sierra & Bert Bates on-line! See this thread for details.
I have an application listening on a port. How do i approach writing a client which writes a string on a port in java?
I am not sure what to look for, a socket approach needs a server to be listening on the port which accepts the connection from the client. I want my writing to a port to be asynchronous i.e. It doesnt matter if any application is listening or not, i should just be able to write.
Joined: Jun 14, 2006
Also, it should be a guaranteed write to the port. because using UDP, there is no guarantee that the message was written to the port or lost before that.
I want my writing to a port to be asynchronous i.e. It doesnt matter if any application is listening or not, i should just be able to write.
As noted before, that's not something sockets can do on their own. I've run into that requirement many times and built some kind of "store and forward" solution. For example, if the server is down you might store messages locally until it comes back up, then send them in batch. Or you might use JMS over a messaging product like IBM's WebSphere-MQ with store and forward built into persistent queuing. Of course that still fails if the MQ server is down.
A good question is never answered. It is not a bolt to be tightened into place but a seed to be planted and to bear more seed toward the hope of greening the landscape of the idea. John Ciardi