sockets

This is a discussion on sockets within the Linux Networking forums, part of the Linux Forums category; hi, I have a question about C sockets. Is this possible: 1. start application, and establish socket connection. 2. quit ...


Go Back   Usenet Forums > Linux Forums > Linux Networking

FAQ Members List Calendar Search Today's Posts Mark Forums Read
  #1 (permalink)  
Old 01-30-2004
Andreas Røsdal
 
Posts: n/a
Default sockets

hi,
I have a question about C sockets. Is this possible:
1. start application, and establish socket connection.
2. quit application, without closing connections (!!)
3. restart application, and continue using old connections?

Andreas R.
Reply With Quote
  #2 (permalink)  
Old 01-30-2004
René Kjellerup
 
Posts: n/a
Default Re: sockets


"Andreas Røsdal" <andrearo@stud.ntnu.no> skrev i en meddelelse
news:Pine.LNX.4.58.0401301359530.17224@tiger.stud. ntnu.no...
> hi,
> I have a question about C sockets. Is this possible:
> 1. start application, and establish socket connection.
> 2. quit application, without closing connections (!!)
> 3. restart application, and continue using old connections?
>
> Andreas R.


Short, No you can't.
As you quit your application, you close all open File descriptores.
And when you create your socket it will be assigned a file descriptor.
which it basically uses for I/O functions at low level.

R.Kj.


Reply With Quote
  #3 (permalink)  
Old 01-30-2004
Owen Jacobson
 
Posts: n/a
Default Re: sockets

On Fri, 30 Jan 2004 14:00:11 +0100, Andreas Røsdal wrote:

> hi,
> I have a question about C sockets. Is this possible:
> 1. start application, and establish socket connection.
> 2. quit application, without closing connections (!!)
> 3. restart application, and continue using old connections?
>
> Andreas R.


Not as described. You might consider having the initial startup spawn a
second process that will persist (see fork(2), various others) to maintain
the connections, that your application connects and disconnects from.

--
Some say the Wired doesn't have political borders like the real world,
but there are far too many nonsense-spouting anarchists or idiots who
think that pranks are a revolution.

Reply With Quote
  #4 (permalink)  
Old 01-30-2004
Phil Frisbie, Jr.
 
Posts: n/a
Default Re: sockets

Andreas Røsdal wrote:

> hi,
> I have a question about C sockets. Is this possible:
> 1. start application, and establish socket connection.
> 2. quit application, without closing connections (!!)
> 3. restart application, and continue using old connections?


It depends on what you mean by 'connection'. If you mean a TCP connection then
the answer is no. If you mean some sort of UDP connection, then the answer is
maybe, if the application's UDP connection protocol allows it.

> Andreas R.


--
Phil Frisbie, Jr.
Hawk Software
http://www.hawksoft.com

Reply With Quote
  #5 (permalink)  
Old 02-02-2004
Jacob Westenbach
 
Posts: n/a
Default Re: sockets

"René Kjellerup" <webmaster@keenan.dk> wrote in message
news:bvdlt1$2n3o$1@news.f.de.plusline.net...
>
> "Andreas Røsdal" <andrearo@stud.ntnu.no> skrev i en meddelelse
> news:Pine.LNX.4.58.0401301359530.17224@tiger.stud. ntnu.no...
> > hi,
> > I have a question about C sockets. Is this possible:
> > 1. start application, and establish socket connection.
> > 2. quit application, without closing connections (!!)
> > 3. restart application, and continue using old connections?
> >
> > Andreas R.

>
> Short, No you can't.
> As you quit your application, you close all open File descriptores.
> And when you create your socket it will be assigned a file descriptor.
> which it basically uses for I/O functions at low level.
>


What you describe sounds a great deal like the way "screen" functions. You
might hunt down the source for screen and see what they're doing.

JW


Reply With Quote
  #6 (permalink)  
Old 02-03-2004
René Kjellerup
 
Posts: n/a
Default Re: sockets



Jacob Westenbach wrote:
> "René Kjellerup" <webmaster@keenan.dk> wrote in message
> news:bvdlt1$2n3o$1@news.f.de.plusline.net...
>
>>"Andreas Røsdal" <andrearo@stud.ntnu.no> skrev i en meddelelse
>>news:Pine.LNX.4.58.0401301359530.17224@tiger.stu d.ntnu.no...
>>
>>>hi,
>>> I have a question about C sockets. Is this possible:
>>> 1. start application, and establish socket connection.
>>> 2. quit application, without closing connections (!!)
>>> 3. restart application, and continue using old connections?
>>>
>>>Andreas R.

>>
>>Short, No you can't.
>>As you quit your application, you close all open File descriptores.
>>And when you create your socket it will be assigned a file descriptor.
>>which it basically uses for I/O functions at low level.
>>

>
>
> What you describe sounds a great deal like the way "screen" functions. You
> might hunt down the source for screen and see what they're doing.
>
> JW
>
>


well the screen is also treated as a file, with FD 0, 1, and 2 which is
in, out, and err respectivly, as are sockets.
That is if you use BSD Sockets, though I don't know for sure in any
other cases.

R.Kj.
--As life grows older, I gain experience.

Reply With Quote
Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

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 Off
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On



All times are GMT +1. The time now is 06:02 AM.


Powered by vBulletin® Version 3.7.3
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO 3.0.0