File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Java in General and the fly likes Socket I/O question Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Java in General
Bookmark "Socket I/O question" Watch "Socket I/O question" New topic

Socket I/O question

James Daley

Joined: Oct 27, 2002
Posts: 4
Is there a standard pattern to follow for developing network applications that do request-response type conversations?
I've built something but it's kludgy and relies upon instanceOf in delivering the response to the object that requested it. The remote system is non-java based.
Michael Ernest
High Plains Drifter

Joined: Oct 25, 2000
Posts: 7292

You're passing an object back and forth but one side isn't Java-based? I'm not sure I understand.
There's pretty much two general ways to do this sort of thing: use object serialization and define your own protocol for the request-response communication, or use a framework like RMI or CORBA to manage some of the lower-level details of that protocol.

Make visible what, without you, might perhaps never have been seen.
- Robert Bresson
James Daley

Joined: Oct 27, 2002
Posts: 4
Actually I was thinking along other lines. I can only communicate with the remote host at the socket api level. I implement a ServerSocket class and need to maintain stateful info about the sessions which operate asynchronously. This is probably a common thing to do, and so thought there just might be an oop design pattern suitable that I could use.
I agree. Here's the link:
subject: Socket I/O question
It's not a secret anymore!