469,336 Members | 5,552 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,336 developers. It's quick & easy.

Windows NT Service and Sockets

How can I used WaitForMultipleObjects() with sockets? The code (shown
below) respresents a very simple echo server using sockets. I need
WaitForMultipleObjects() so I can wait for both a new connection and
the stop command from the service manager.

Your help is greatly appreciated. Thanks.

Olaf
def SvcDoRun(self):
sock = socket(AF_INET, SOCK_STREAM)
sock.bind(('localhost', 53574))
sock.listen(1)

connection, addr = sock.accept()
data = connection.recv(1024)
connection.send(data)
connection.close()

# We do nothing other than wait to be stopped!
win32event.WaitForSingleObject(self.hWaitStop,
win32event.INFINITE)
Jul 18 '05 #1
1 1614
Ol********@compuserve.com (Olaf Meding) writes:
How can I used WaitForMultipleObjects() with sockets? The code (shown
below) respresents a very simple echo server using sockets. I need
WaitForMultipleObjects() so I can wait for both a new connection and
the stop command from the service manager.

Your help is greatly appreciated. Thanks.


Look into win32file.WSAEventSelect, it allows to associate an event
object with FD_XXX network events.

Thomas
Jul 18 '05 #2

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

1 post views Thread by A Hirsi | last post: by
11 posts views Thread by kshetgar | last post: by
reply views Thread by Kumar Shetgar | last post: by
3 posts views Thread by jwpaco | last post: by
1 post views Thread by mdhaman | last post: by
2 posts views Thread by =?Utf-8?B?U2Vhbk1hYw==?= | last post: by
reply views Thread by suresh191 | last post: by
reply views Thread by Marylou17 | last post: by
1 post views Thread by Marylou17 | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.