A client for the mirror server.
| 93 | |
| 94 | |
| 95 | class Client: |
| 96 | |
| 97 | |
| 98 | |
| 99 | "A client for the mirror server." |
| 100 | def __init__(self, server, port): |
| 101 | "Connect to the given mirror server." |
| 102 | self.socket = socket.socket(socket.AF_INET, socket.SOCK_STREAM) |
| 103 | self.socket.connect((server, port)) |
| 104 | |
| 105 | def mirror(self, s): |
| 106 | "Sends the given string to the server, and prints the response." |
| 107 | self.socket.send(s) |
| 108 | |
| 109 | |
| 110 | def close(self): |
| 111 | self.socket.send('\r\n') #We don't want to mirror anything else. |
| 112 | self.socket.close() |
| 113 | |
| 114 | if __name__ == '__main__': |
| 115 |
no outgoing calls
no test coverage detected