File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Socket connection

 
Joshua Fix
Ranch Hand
Posts: 57
  • 0
  • Mark post as helpful
  • send pies
  • 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?
 
Jeffry Kristianto Yanuar
Ranch Hand
Posts: 759
  • 0
  • Mark post as helpful
  • send pies
  • 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)
 
Jens Voss
Greenhorn
Posts: 14
  • 0
  • Mark post as helpful
  • send pies
  • 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
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks Jens
 
Joshua Fix
Ranch Hand
Posts: 57
  • 0
  • Mark post as helpful
  • send pies
  • 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?
 
Soroj Margun
Ranch Hand
Posts: 44
  • 0
  • Mark post as helpful
  • send pies
  • 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.
 
I agree. Here's the link: http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic