I want to do reboot testing on one computer (lets call it A) by turning power off and on via a network controlled power outlet by a computer B. I want the computer A to report to a computer B on each boot so that it can keep track of when it succeeded. What is the simplest python setup that can do this?
Here's a simple Python setup that can accomplish what you want:

1. On Computer A, write a Python script that will run on each boot and send a message to Computer B to report its status. The script can use a library like socket or smtplib to send the message over the network.

2. On Computer B, write a Python script that listens for incoming messages from Computer A and records the status updates in a log file or a database.

Here's some example code for Computer A:
```python
import socket

def send_message(message):
    with socket.socket(socket.AF_INET, socket.SOCK_STREAM) as s:
        s.connect(("computer_b_ip", 8080))
        s.sendall(message.encode())

send_message("Reboot succeeded")
```

And here's some example code for Computer B:
```python
import socket

def listen_for_messages():
    with socket.socket(socket.AF_INET, socket.SOCK_STREAM) as s:
        s.bind(("0.0.0.0", 8080))
        s.listen()
        conn, addr = s.accept()
        with conn:
            while True:
                data = conn.recv(1024)
                if not data:
                    break
                print("Message from", addr, ":", data.decode())

listen_for_messages()
```

This is just a starting point. You may want to add error handling, logging, or other features to the code to make it more robust and usable for your specific needs.
Below is an instruction that describes a task. Write a response that appropriately completes the request.

### Instruction:

I want to do reboot testing on one computer (lets call it A) by turning power off and on via a network controlled power outlet by a computer B. I want the computer A to report to a computer B on each boot so that it can keep track of when it succeeded. What is the simplest python setup that can do this?

### Response:

Here's a simple Python setup that can accomplish what you want:

1. On Computer A, write a Python script that will run on each boot and send a message to Computer B to report its status. The script can use a library like socket or smtplib to send the message over the network.

2. On Computer B, write a Python script that listens for incoming messages from Computer A and records the status updates in a log file or a database.

Here's some example code for Computer A:
```python
import socket

def send_message(message):
    with socket.socket(socket.AF_INET, socket.SOCK_STREAM) as s:
        s.connect(("computer_b_ip", 8080))
        s.sendall(message.encode())

send_message("Reboot succeeded")
```

And here's some example code for Computer B:
```python
import socket

def listen_for_messages():
    with socket.socket(socket.AF_INET, socket.SOCK_STREAM) as s:
        s.bind(("0.0.0.0", 8080))
        s.listen()
        conn, addr = s.accept()
        with conn:
            while True:
                data = conn.recv(1024)
                if not data:
                    break
                print("Message from", addr, ":", data.decode())

listen_for_messages()
```

This is just a starting point. You may want to add error handling, logging, or other features to the code to make it more robust and usable for your specific needs.
