LinuxQuestions.org
View the Most Wanted LQ Wiki articles.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Networking
User Name
Password
Linux - Networking This forum is for any issue related to networks or networking.
Routing, network cards, OSI, etc. Anything is fair game.

Notices

Reply
 
Search this Thread
Old 10-22-2010, 04:07 AM   #1
abhayb
LQ Newbie
 
Registered: Oct 2010
Posts: 8
Blog Entries: 1

Rep: Reputation: 0
Reusing socket without closing it


I want to reuse a socket without closing the same. I am running a client and it connects to a server. The server shuts down in between and comes up. So after this I want to reconnect to server without closing my socket and creating another one. Is there any way?
 
Old 10-22-2010, 05:01 AM   #2
estabroo
Senior Member
 
Registered: Jun 2008
Distribution: debian, ubuntu, sidux
Posts: 1,094
Blog Entries: 2

Rep: Reputation: 111Reputation: 111
Have you tried just doing another call to connect() to re-establish the connection? (assuming C here)
 
Old 10-22-2010, 06:10 AM   #3
abhayb
LQ Newbie
 
Registered: Oct 2010
Posts: 8
Blog Entries: 1

Original Poster
Rep: Reputation: 0
Quote:
Originally Posted by estabroo View Post
Have you tried just doing another call to connect() to re-establish the connection? (assuming C here)
Yes I've tried that. But it didn't work.The connect call returned -1.The attributes used for the 2nd time to do a connect() are same,i.e the port number and server IP are all same.
Sorry forgot to mention; platform is C.

Last edited by abhayb; 10-22-2010 at 06:11 AM.
 
Old 10-27-2010, 05:23 AM   #4
estabroo
Senior Member
 
Registered: Jun 2008
Distribution: debian, ubuntu, sidux
Posts: 1,094
Blog Entries: 2

Rep: Reputation: 111Reputation: 111
Well I guess that's your answer then, not reusable and you have to re-establish the connection using a new socket, guess the local side keeps some cruft around, I wonder if after the keep-alive timeout occurs you could do it, but that's usually several minutes and not worth the wait.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Reusing /home partition JMJ_coder Linux - General 3 05-14-2008 12:57 PM
Firewall prevents socket from closing promptly kev1 Linux - Networking 2 01-10-2007 09:19 AM
recv() is not coming out of blocking after closing the socket. arunka Linux - Networking 2 06-30-2006 09:52 PM
Closing Socket in MultiThreaded Application Fails laalitseth Red Hat 0 04-21-2004 12:44 AM
Reusing .config during kernel rebuild ssu4716 Linux - General 1 04-01-2002 12:06 PM


All times are GMT -5. The time now is 05:22 PM.

Main Menu
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration