• Home
  • History
  • Annotate
  • Line#
  • Navigate
  • Raw
  • Download
  • only in /macosx-10.9.5/pyobjc-42/2.5/pyobjc/pyobjc-framework-SystemConfiguration/Examples/CallbackDemo/
1#!/usr/bin/env python
2"""
3Exercise some API's related to SCNetworkConnection.
4
5NOTE: this example doesn't actually work yet as the author of this script
6doesn't use PPP :-)
7
8Usage:
9    python netcon.py
10"""
11from SystemConfiguration import *
12
13def connectionChanged(connection, status, info):
14    print "Status of %s connection changed: %s"(info, status)
15
16
17def main():
18    conn = SCNetworkConnectionCreateWithServiceID(None,
19            "Automatic",
20            connectionChanged,
21            "foobar")
22
23    print conn
24    assert conn is not None
25
26    loop = CFRunLoopGetCurrent()
27    SCNetworkConnectionScheduleWithRunLoop(conn, loop, kCFRunLoopCommonModes)
28    CFRunLoopRun()
29
30if __name__ == "__main__":
31    main()
32