How to change the IdleTimeout/LeaseTimeout on NetTcpBinding?

To modify properties that are not exposed on the standard binding we can create a CustomBinding from the provided standard binding. We can then find the element required on the particular CustomBinding and tweak it. Another option would be to just hand craft the full standard binding if you know exactly how to stack up the elements. Here is an example to how to tweek the IdleTimeout.

private static CustomBinding GetIdleBinding(int mins){    NetTcpBinding tcpBinding = new NetTcpBinding();    CustomBinding customBinding = new CustomBinding(tcpBinding);    TcpTransportBindingElement transport = customBinding.Elements.Find();    transport.ConnectionPoolSettings.IdleTimeout = TimeSpan.FromMinutes(mins);    return customBinding;}

The Rear View Mirror

Water flowing down the road. The sewers clogged and the streets flooded. Looks like the government didn’t get time from their bickering and fake encounters. This year again the rain manages to kill and starve hundreds. This is not a game we are playing. There are cards to be dealt and they are dealt only once. If you don’t play it right, there might not be another chance. There is no time for frivolity or any excuse to stop and admire this downpour. The message is coming and there is one one chance to get through this.“Zando, Do you hear me?” Asked Lokee. “Stop acting so naive, I’ve known you long enough to see through that ‘I don’t give a damn’ look of yours,  We’ve seen too many days and nights of flowing water and blood in this city. I think it is time we made some changes. Don’t you dare be the complaint box again. Screw your negativity cause your not taking me down with that today.”“Lou” , As Zando called him dearly. “You know I can’t miss this. I know I am a bit lost, actually always lost. But this just a bit too important to just be myself. I sometimes wish I could just though, but damn these opportunities. They just make you do things. Anyway wait by the clipper. I’ll come in a few minutes.”You better, I don’t want to wait. I swear I’ll beat the crap out of you if you do anything stupid.  No time for a shower or a shave. So just get out as soon as your done with your smoke. I can’t risk it like last time so just finish your damn smoke before you get out. – Lokee wasn’t always like this. But times have changed and age makes you a cynic and there were not many things that someone in that age could experiment with to get things. There are very few things that gets Lokee excited and Zando wasn’t helping in anyway. Actually Zando has always been Lokee’s anchor. The kind that never lets you use your full potential. Think of it like an anchor on a speed boat. What good would that do!Whistling and a half smoked cigarette in hand, Zando comes down the elevator and walks towards their scooter which they lovingly call clipper. Clipper comes out each time Zando manages to get Lokee’s car into the body shop. Zando isn’t a fast driver. He’s just careless. “Damn Lokee, where is the car? I hate this thing. It’s so damn hard to smoke with the wind hitting your face mannnnnnn. Oh oh… my bad. Sorry I forgot. I swear I forgot. Just so that you know I wasn’t drunk. Actually I was the designated driver for the night but the guy who sat with me in front wasn’t easy to handle…”Zando, shut the fuck up. I don’t want to hear your crappy apologies right now. We’ll deal with that later. Right now lets just get to the damn campus. Rushi asked us to get there asap an hour ago so stop fooling around and lets just go man. – Lokee was tired and exhausted trying reason with Zando. Nothing has changed in the last 10 years since high school. There were times when Lokee has beat up Zando for his silliness and Lokee constantly wonders why he still hasn’t moved out with his girl friend. Zando doesn’t really mind getting punched by Lokee. He doesn’t mind get punched by anyone.They drove away on Clipper through the sewage filled streets. The rain hasn’t yet fully stopped but it won’t last long. They have to play the game soon. Some games can be played only once. It’s like a lottery. You can never play with the same ticket twice. On the way Zando shrugs back into his hole. A place his brain constantly retreats when things around him moves fast. Like the road below his feet and the sounds of the hawkers and the children playing in the pot hole puddles. He wasn’t in a prettier place, it was just quieter. He enjoyed his solitude, its came to him naturally and he would go there even if the shop keeper in a bazaar was yelling at the top of his voice trying to make a deal with Lokee. This was his weakness and also his strength. His cards were being dealt but Lokee knew that only he can play Zando’s cards since Zando didn’t care and there was nothing in the world that could change this. Lokee tries to keep his eyes on the road and while driving away notices his little house’s gate disappears slowly in clippers cracked rear view mirror.

Media_httpfarm5static_dbyzr