Help coderanch get a
new server
by contributing to the fundraiser
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Socket Questions

 
Greenhorn
Posts: 20
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
 
Greenhorn
Posts: 17
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
 
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
 
My pie came with a little toothpic holding up this tiny ad:
We need your help - Coderanch server fundraiser
https://coderanch.com/t/782867/Coderanch-server-fundraiser
reply
    Bookmark Topic Watch Topic
  • New Topic