Saturday, December 5, 2015

TCP/IP Client server persistent connections

So just last week I was moved to another project where I'm gonna be working on a client server program.
So we are going to be using TCP/IP for communication. And its exciting since its been over two years since I last dabbled in networking. Life is looking exciting.
Anyway so the problem was everywhere I looked, I could find only simple networking examples. So I dug in and put together some code to keep a connection alive for back and forth connection. What I did was basically keep the connection open for next request rather than closing it and reopening it.
This enabled me to have a continuous chat like communication between client and server.
Then I spent some time refactoring the code to make it streamlined.
But I still have to add error handling to it. I'll share it here when I have it ready. It was fun!!!

No comments:

Post a Comment