binds to a port, waits for the debugger to connect
(port)
| 466 | |
| 467 | |
| 468 | def start_server(port): |
| 469 | """binds to a port, waits for the debugger to connect""" |
| 470 | s = create_server_socket(host="", port=port) |
| 471 | |
| 472 | try: |
| 473 | s.listen(1) |
| 474 | # Let the user know it's halted waiting for the connection. |
| 475 | host, port = s.getsockname() |
| 476 | msg = f"pydevd: waiting for connection at: {host}:{port}" |
| 477 | print(msg, file=sys.stderr) |
| 478 | pydev_log.info(msg) |
| 479 | |
| 480 | new_socket, _addr = s.accept() |
| 481 | pydev_log.info("Connection accepted") |
| 482 | # closing server socket is not necessary but we don't need it |
| 483 | s.close() |
| 484 | return new_socket |
| 485 | except: |
| 486 | pydev_log.exception("Could not bind to port: %s\n", port) |
| 487 | raise |
| 488 | |
| 489 | |
| 490 | def start_client(host, port): |
no test coverage detected