Win a copy of Think Java: How to Think Like a Computer Scientist this week in the Java in General forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Socket I/O question

 
James Daley
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Sheriff
Posts: 7292
Netbeans IDE VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
James Daley
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic