Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Should sockets be kept open or torn down [duplicate]

Possible Duplicate:
Should I close a socket (TCPIP) after every transaction?

Lets say I have some type of interprocess communication that works using sockets.

Should my processes establish a connection and hold it open (1 thread per client or similar) sending data when it needs; or is a better approach to simply establish a connection, send the data I wish, close it and enter my wait state again?

What is usually the approach to this problem?

like image 856
Maxim Gershkovich Avatar asked Apr 13 '11 05:04

Maxim Gershkovich


1 Answers

I asked this same question and all three responses said to leave it open. I went with that, and it seems to be working for me.

Should I close a socket (TCPIP) after every transaction?

like image 113
Jess Avatar answered Sep 28 '22 00:09

Jess