f



closing server's socket from worker process on windows

Here's my problem.

We have a server process which accepts connections (using accept call,
not WSA...), and than it spawns worker process to handle the
connection.
The worker process uses the socket received from the 'accept' performed
by the server.

The issue is if I have some worker processes running, and than stop my
server process, and try to connect from client, it seems that the
connection gets attached to one of the running worker processes.
Than I can start the server process, but the new client won't get
connected until I shutdown the worker process (until that time the
server can't accept new connections).  I should mention that clients
have retry logic, so if at first they don't succeed they retry for few
minutes.

But if after shutting down the server process, it's started up before
the new client tries to connect, than the previous worker processes can
continue to run and new client gets connected just fine.

I believe the issue is that the worker procesess inherit parent's
handle, and the new clients connect to them, even though no one will
ever 'accept' their connection.


What I tried so far is, I passed the value of server's socket to the
worker processes (by passing it on the command line such as:
--parent_socket 234), and I closed it in the worker process using
CloseHandle.  That fixes the problem I mentioned above, and if the new
client comes in before the server is started it will get connected to
the server once it's started.
BUT! socket is supposed to be closed using closesocket, not
CloseHandle, so I tried closesocket, and the problem came back.  I also
tried close, but the problem is still there.  What's up with this?


And finally a question: Can worker processes close all but the
inherited socket on which they should be talking to client?
(Note that I tried DuplicateHandle with inherit flag set to FALSE, but
the server's handle still gets inherited.)

Thank you.
Alex

0
anywherenotes
12/5/2006 6:14:05 PM
comp.win.tools.winsock 400 articles. 0 followers. Post Follow

0 Replies
258 Views

Similar Articles

[PageSpeed] 21

Reply:

Similar Artilces:

ANN: Stylus Studio Wins SQL Server Magazine's Readers' Choice Award for Best XML Development Tool
[Announce] Stylus Studio "Rises Above the Competition" by Offering Innovative Productivity Tools to the XML Developer Community Bedford, MA, August 30, 2005 -- Stylus Studio ( http://www.stylusstudio.com ), the industry-leading provider of development tools for advanced XML data integration, today announced that Stylus Studio=AE 6 XML Professional Edition has won SQL Server Magazine's 2005 Readers Choice Award for best XML development tool. Stylus Studio 6 XML Professional Edition has surged in popularity in recent months in the XML community; quickly earning a reputation among ...

W2k3 OID's and MIB's for windows server 2003
I want to monitor my windows server 2003 machine and at this moment the hdd space. i know it's possible but i cannot find the mib's which i can walk the oid's with or the descripsion of the oid's does anyone know where i can find them? ...

Cisco Switches with ACL's between VLAN's and windows servers
Question #1 I have a domain forest in my current WAN. I have been asked to tighen up security but implementing ACL's between VLAN's. My problem is this. I have say office A on VlanA with the main controller and office B on VlanB with a child controller. What ports am i going to have to open up between those vlans so the two servers can talk to each other and keep active directory happy. Question #2 Would I need to open the same ports say if a workstation was on a different Vlan then the server it authenticates with. Not sure this would happen but just wanted to know in the event ...

[ace-users] How to reactor server do close the client's connection on it's own initiative
Hi,All: MY ENVIRONMENT: ACE VERSION: 5.5.1 HOST MACHINE: Red Hat AS4 Enterprise Update2 Linux 2.6.9-22.ELsmp X86_64 GNU/Linux GCC 3.4.4 20050721 (Red Hat 3.4.4-2) ace/config.h #define ACE_HAS_XML_SVC_CONF #define ACE_HAS_EVENT_POLL #define ACE_HAS_LINUX_NPTL #include "ace/config-linux.h" DESCRIPTION: one question: I wrote a sample use TP_Reactor, reference $ACE_ROOT/examples/APG/TP_Reactor. I want sever do close the connection from the client on it's own initiative, so I tried to return -1 in handle_input after server got some bytes from the client, ...

It's on-it's off-it's on, it's off -WHY?
IS THIS THE CORRECT FORUM? Hope so. We have three computer networked at home...all with Windows XP. one of those is a laptop. Some mornings all 3 can see each other and transfer files...then mysteriously one or more will disappear. No contact....then later it's back. The laptop is the worst. Most often it won't let us in...but sometimes it will. No obvious reason. The most INFURIATING part is the message "see your administrator". Dammit Bill Gates...don't you realize that most networks are small offices without a Majestic Royal Administrator sitting his i...

It's just a hop, skip and a jump from Homer's site to a Windows Server download
http://www.angelfire.com/linux/dfs0/Homer_promoting_WinServer.jpg Good job, Hypocrite Homer! I'm sure MS thanks you for making open sourcers look like greedy idiots. On Thu, 02 Feb 2012 17:40:27 -0500, DFS wrote: > http://www.angelfire.com/linux/dfs0/Homer_promoting_WinServer.jpg > > > Good job, Hypocrite Homer! I'm sure MS thanks you for making open > sourcers look like greedy idiots. And that's exactly what they are. It's about time [Homer] got something correct. Thanks [Homer] ! ...

Connecting to Window Server from 'Tools'
I have in front of me a program that is packaged as a tool [single-file Mach-O executable, as opposed to a bundle] but links to and uses Carbon.framework. If I double-click the file, it runs in Terminal and starts displaying its windows, but it does not appear in the dock, and will only respond to AppleEvents and CoreGraphics events. If I take the same file and either place it in a minimal app bundle, or add a 'carb' or 'plst' resource to it, it runs in Terminal, displays its windows, appears in the dock, and responds to all events. Now, I realize this is a poorly...

in.close() closes out's socket -- is this a bug?
I have buffered input and output streams going to a socket. When I close the input stream, it closes the socket without first flushing the output buffer. Should it do this? I would expect it to close the streams, but leave the socket alone. The following code demonstrates this problem. Invert the order of in.close() and out.close() and the program works. Here is my test code: Run this program by executing the code then running "telnet localhost 8080" import java.io.*; import java.net.*; public class TestFlush2 { public static void main(String[] args) throws IOException { Serve...

Minuteman's Production server. your provider's email server sends a message back to the Production server.
Our management team at Minuteman Library Network failed to remedy difficulty with the network, would any of you kind folks out there have any hints, tips or pointers?... _ _ _ _ _ Cambridge Public Library http://cambridgema.gov/cpl _ _ _ _ _ The problem is when the Production server sends an email notice to your provider, your provider's email server sends a message back to the Production server to verify that it is a legitimate email server. Because this is Minuteman's Production server and is not really an email server, they block those types of queries at the firewall. ...

Minuteman's Production server. your provider's email server sends a message back to the Production server.
Our management team at Minuteman Library Network failed to remedy difficulty with the network, would any of you kind folks out there have any hints, tips or pointers?... _ _ _ _ _ Cambridge Public Library http://cambridgema.gov/cpl _ _ _ _ _ The problem is when the Production server sends an email notice to your provider, your provider's email server sends a message back to the Production server to verify that it is a legitimate email server. Because this is Minuteman's Production server and is not really an email server, they block those types of queries at the firewall. ...

Can a Processes' Window be the Child of Another Processes' Window?
Hi Again Folks: I'm trying to figure a method to constrain child processes' windows within a window of a parent process. I had some luck making the child processes top level windows children of a window in the parent process, but I want the child process icons in the task bar, and this put them at the bottom of the parent processes' widow. Now I'm thinking about making the child processes' top level windows invisible, which I believe will put their icons in the task bar, and doing the real work of the child process with calls to DialogBoxParam() ...

Minuteman's Production server. your provider's email server sends a message back to the Production server.
Our management team at Minuteman Library Network failed to remedy difficulty with the network, would any of you kind folks out there have any hints, tips or pointers?... _ _ _ _ _ Cambridge Public Library http://cambridgema.gov/cpl _ _ _ _ _ The problem is when the Production server sends an email notice to your provider, your provider's email server sends a message back to the Production server to verify that it is a legitimate email server. Because this is Minuteman's Production server and is not really an email server, they block those types of queries at the...

SN#17052 Win a Thumper Server: Enter Sun's 'Thump This' Contest
SYSTEM NEWS FOR SUN USERS Vol 103 Issue 4 2006-09-25 Article 17052 from section "Promotions" Winner Receives a Sun Fire[TM] X4500 Server Got any ideas about how you might use the "Thumper," Sun's new Sun Fire[TM] X4500 Server? Why not submit those bright ideas to see whether they might win one of these servers for you in the Sun "Thump This" contest. Jonathan Schwartz explains the competition online. Details at http://sun.systemnews.com/g?A=17052 Have a custom version of 'System News for Sun Users' delivere...

SN#17124 Win a Thumper Server: Enter Sun's 'Thump This' Contest
SYSTEM NEWS FOR SUN USERS Vol 104 Issue 2 2006-10-09 Article 17124 from section "Promotions" Winner Receives a Sun Fire[TM] X4500 Server Got any ideas about how you might use the "Thumper," Sun's new Sun Fire[TM] X4500 Server? Why not submit those bright ideas to see whether they might win one of these servers for you in the Sun "Thump This" contest. Jonathan Schwartz explains the competition online. Details at http://sun.systemnews.com/g?A=17124 Have a custom version of 'System News for Sun Users' delivere...

Web resources about - closing server's socket from worker process on windows - comp.win.tools.winsock

Resources last updated: 1/28/2016 6:41:03 AM