-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
john.wohl@uconn.edu
committed
Dec 5, 2019
1 parent
96cdbb4
commit 331c381
Showing
1 changed file
with
35 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
import socket | ||
import sys | ||
import time | ||
|
||
class ArtemisClient: | ||
def __init__(self, server_host, server_port): | ||
self.server_host = server_host | ||
self.server_port = server_port | ||
|
||
def start(self): | ||
# Create socket and connect to server | ||
try: | ||
server_sock = socket.socket( | ||
socket.AF_INET, socket.SOCK_STREAM) | ||
server_sock.connect((self.server_host, self.server_port)) | ||
except OSError: | ||
if server_sock: | ||
server_sock.close() | ||
sys.exit(1) | ||
|
||
#server_sock.sendall("!".encode("utf-8")) | ||
print(server_sock.recv(1024).decode("UTF-8")) | ||
print(server_sock.recv(1024).decode("UTF-8")) | ||
server_sock.send("13\r\n".encode()) | ||
print(server_sock.recv(1024).decode("UTF-8")) | ||
|
||
server_sock.close() | ||
|
||
print("\nDone!") | ||
|
||
|
||
|
||
client = ArtemisClient("artemis.engr.uconn.edu", 4705) | ||
client.start() | ||
|