• 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:
  • Tim Cooke
  • Campbell Ritchie
  • paul wheaton
  • Ron McLeod
  • Devaka Cooray
Sheriffs:
  • Jeanne Boyarsky
  • Liutauras Vilda
  • Paul Clapham
Saloon Keepers:
  • Tim Holloway
  • Carey Brown
  • Piet Souris
Bartenders:

Socket connection

 
Ranch Hand
Posts: 57
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I'm using sockets for my network connection. I open a new socket for each transaction and then shut it down. Is this acceptable? Is this what other people are doing, or should I persist the session until the client is shut down?
 
Ranch Hand
Posts: 759
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
My approach is like this :

when the application starts, it ask the user to input the server address.
Then it connects to the server.
An then the user can book a record and search for record(s) without disconnecting and connecting again.

I used socket connection too, I thought I'm the only one who likes to burdening myself by using socket .

I hope this will help.

Jeffry Kristianto Yanuar
SCJP 5.0
SCJA
SCJD (Working on UrlyBird 1.3.2 : almost done)
 
Greenhorn
Posts: 14
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Originally posted by Jeffry Kristianto Yanuar:
I used socket connection too, I thought I'm the only one who likes to burdening myself by using socket .



Hi Jeffry,

no, I'm with you too - I am using sockets as well, and I don't think it's that much of a burden
It may be just a matter of personal taste, but I like sockets much more because I think it is easier to contol (and customize) communication behavior.

Good luck with whatever is left with your assignment!

Regards,
Jens
 
Jeffry Kristianto Yanuar
Ranch Hand
Posts: 759
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thanks Jens
 
Joshua Fix
Ranch Hand
Posts: 57
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Jens, do you keep your socket connection open for the entire client session, or do you open and close a session with each transaction? Does anybody else have any comments on doing one way vs. the other?
 
Ranch Hand
Posts: 44
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi all,

Close socket and reopen it every time that same client connect may cause your machine to run out of port when many client simultaneously connect due to a waiting period gap when closing socket.
 
Consider Paul's rocket mass heater.
reply
    Bookmark Topic Watch Topic
  • New Topic