Click here to Skip to main content
15,892,072 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi Guys

I am creating a client embedded application to execute from inside a GPRS modem.

Regarding TCP connections, is it more resource intensive to create and then disconnect TCP connection continuously(i.e polling), or is it more resource intensive to keep a TCP connection open all the time??

Thank you

Regards
Posted

1 solution

When polling is done once every x seconds it might be better to disconnect and maybe even delete the object, otherwise it would probably be more efficient to keep it going. It's a trade off between keeping the connection and with that the memory needed or otherwise freeing up memory but need more cycles to setup the connection again.

It would probably be best to test both methods if you're still not sure. The polling can be done by some separate code that can then be easily replaced with any other polling scheme. You could also think of a method where the connection is kept open for some time before closing it to avoid fast disconnect/connect actions when polling more intensively. So even a more dynamic scheme could be interesting to test before choosing the actual implementation you are going to use.

Good luck!
 
Share this answer
 
Comments
sach262 12-Nov-10 4:15am    
At the moment I am keeping the TCP connection open constantly because I am polling the status response from an IMAP server to determine if new email has arrived. When a new email arrives I send out an SMS. Since it is an embedded application , I want to optimize speed of execution on the client embedded side, hence I keep the connection open to the IMAP server so I dont have to waste time in disconnecting and connecting again.

I assume keeping the connection open constantly is more resource intensive for the server than it is for my embedded client.
E.F. Nijboer 12-Nov-10 12:15pm    
You could also test it to check it out :-D
sach262 12-Nov-10 15:43pm    
lol yeah I have implemented it, just wish i had a device to monitor resources like RAM on this modem i am using. thank you and take care

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900