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 ...
|
|||||||
| FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
|
|||
|
"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. |
|
|||
|
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. |
|
|||
|
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 |
|
|||
|
"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 |
|
|||
|
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. |