• Post Reply Bookmark Topic Watch Topic
  • New Topic

Socket Questions

 
Jonathan Oblea
Greenhorn
Posts: 20
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi All,
I have one server application and a client applet
program that updates one database table using Sockets. The client applet passes an object data type through sockets using ObjectOutputStream and this object actually contain all the fields that will be updated. The server application reads the OutputStream then updates the database table.
I'm trying to find ways to have multiple client applet programs that will update multiple database tables using Sockets. Any suggestions ?
Thank you in advance.
Best regards, Ian.
 
Tony Combe
Greenhorn
Posts: 17
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I'm only a beginner so this advice might not be that good but if your talking about having the server program handle multiple clients then thats fairly easy. All you need to do is pass the socket that is returned using the accept method on the serversocket to, well, anything you like, an array of sockets or an object that accepts a socket as a construtor, does'nt matter really. And then when ever you try to read or write to a socket that has been created the info will only go to or be recieved form the applet that made that particular connection.
 
steven peh
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Sounds like you need to create a multi-threaded server, where the server spawns a new thread passing the socket it accepted to the new thread.
Coding a multi-threaded server is fairly simple depending on what your needs are. If your operations are exclusive and independant of one another (i.e. you applets are sending table updates to the server and is not dependant on the operation of other applets), then it should be pretty straightforward, if not then it'll require more work to synchronize the threads.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!