Ejemplo n.º 1
0
from P2.Client0 import Client

PRACTICE = 2
EXERCISE = 3

print(f"-----| Practice {PRACTICE}, Exercise {EXERCISE} |------")

# -- Parameters of the server to talk to
IP = "127.0.0.1"
PORT = 63342

# -- Create a client object
c = Client(IP, PORT)

# -- Send a message to the server
print("Sending a message to the server...")
response = c.talk("Testing!!!")
print(f"Response: {response}")
Ejemplo n.º 2
0
from P1.Seq1 import Seq
from P2.Client0 import Client

PRACTICE = 2
EXERCISE = 7
print(f"-----| Practice {PRACTICE}, Exercise {EXERCISE} |------")

FOLDER = "../Session-04/"
FILENAME = "FRAT1"
# -- Parameters of the server to talk to
IP = "127.0.0.1"
PORT = 58788

c1 = Client(IP, PORT)
c2 = Client(IP, PORT + 1)

print(c1)
print(c2)

s = Seq()
s.read_fasta(FOLDER + FILENAME)
bases = str(s)

length = 10

print(f"Gene {FILENAME}: {bases}")

c1.talk(f"Sending {FILENAME} Gene to the server, in fragments of {length} bases...")
c2.talk(f"Sending {FILENAME} Gene to the server, in fragments of {length} bases...")

for index in range(0,10):
Ejemplo n.º 3
0
from P2.Client0 import Client

PRACTICE = 2
EXERCISE = 2

print(f"-----| Practice {PRACTICE}, Exercise {EXERCISE} |------")

# -- Parameters of the server to talk to
IP = "192.168.1.66"
PORT = 8080

# -- Create a client object
c = Client(IP, PORT)

# -- Test the ping method
print(c)
Ejemplo n.º 4
0
from P2.Client0 import Client

PRACTICE = 2
EXERCISE = 4

print(f"-----| Practice {PRACTICE}, Exercise {EXERCISE} |------")

IP = "127.0.0.1"
PORT = 8080

c = Client(IP, PORT)
print(c)
c.debug_talk("Message 1---")
c.debug_talk("Message 2: Testing !!!")
Ejemplo n.º 5
0
from P2.Client0 import Client

PRACTICE = 2
EXERCISE = 3

print(f"-----| Practice {PRACTICE}, Exercise {EXERCISE} |------")

IP = "127.0.0.1"
PORT = 8081
c = Client(IP, PORT)
response = c.talk("Message")
print("Response:", response)
Ejemplo n.º 6
0
from P2.Client0 import Client

PRACTICE = 2
EXERCISE = 1

print(f"-----| Practice {PRACTICE}, Exercise {EXERCISE} |------")

IP = "127.0.0.1"
PORT = 8080

# -- Create a client object
c = Client(IP, PORT)

# -- Test the ping method
c.ping()

# -- Print the IP and PORTs
print(f"IP: {c.ip}, {c.port}")
Ejemplo n.º 7
0
from P2.Client0 import Client

PRACTICE = 2
EXERCISE = 4

print(f"-----| Practice {PRACTICE}, Exercise {EXERCISE} |------")

IP = "127.0.0.1"
PORT = 8081
c = Client(IP, PORT)

c.debug_talk("Message 1")
c.debug_talk("Message 2")
Ejemplo n.º 8
0
from P2.Client0 import Client
from pathlib import Path
from P1.Seq1 import Seq
PRACTICE = 2
EXERCISE = 7

print(f"-----| Practice {PRACTICE}, Exercise {EXERCISE} |------")

IP = "127.0.0.1"
PORT = 8081
PORT_2 = 8082

c = Client(IP, PORT)
c_2 = Client(IP, PORT_2)

s = Seq()
s.read_fasta('../P2/FRAT1.txt')
count = 0
i = 0
while i < len(s.strbases) and count < 10:
    fragment = s.strbases[i:i + 10]
    count += 1
    i += 10
    if count % 2 == 0:
        print(c_2.talk("Fragment " + str(count) + ": " + fragment))
    else:
        print(c.talk("Fragment " + str(count) + ": " + fragment))
Ejemplo n.º 9
0
from P2.Client0 import Client

# PORT and IP
PORT = 40974
IP = "127.0.0.1"

for index in range(0, 5):
    c = Client(IP, PORT)
    c.debug_talk(f" Message : {index}")
Ejemplo n.º 10
0
from P2.Client0 import Client
from pathlib import Path

PRACTICE = 2
EXERCISE = 5

print(f"-----| Practice {PRACTICE}, Exercise {EXERCISE} |------")

IP = "127.0.0.1"
PORT = 8081
c = Client(IP, PORT)
print(c.talk("Sending the U5 Gene to the server...."))
print(c.talk(Path("U5.txt").read_text()))
Ejemplo n.º 11
0
from P1.Seq1 import Seq
from P2.Client0 import Client

PRACTICE = 2
EXERCISE = 5
print(f"-----| Practice {PRACTICE}, Exercise {EXERCISE} |------")

FOLDER = "../Session-04/"
FILENAME = "U5"
# -- Parameters of the server to talk to
IP = "127.0.0.1"
PORT = 63342

c = Client(IP, PORT)
print(c)

s = Seq()
s.read_fasta(FOLDER+FILENAME)

c.debug_talk(f"Sending {FILENAME} Gene to the server")
c.debug_talk(str(s))

Ejemplo n.º 12
0
from P1.Seq1 import Seq
from P2.Client0 import Client

PRACTICE = 2
EXERCISE = 6
print(f"-----| Practice {PRACTICE}, Exercise {EXERCISE} |------")

FOLDER = "../Session-04/"
FILENAME = "FRAT1"
# -- Parameters of the server to talk to
IP = "127.0.0.1"
PORT = 63342

c = Client(IP, PORT)
print(c)

s = Seq()
s.read_fasta(FOLDER + FILENAME)
bases = str(s)
length = 10

print(f"Gene {FILENAME}: {bases}")

c.talk(f"Sending {FILENAME} gene,in fragments of {length} bases")

for i in range(0, 5):
    fragment = bases[i * length:(i + 1) * length]
    print(f"Fragment {i+1}: {fragment}")
    c.talk(f"Fragment {i + 1}: {fragment}")
Ejemplo n.º 13
0
from P2.Client0 import Client
from pathlib import Path
from P1.Seq1 import Seq
PRACTICE = 2
EXERCISE = 6

print(f"-----| Practice {PRACTICE}, Exercise {EXERCISE} |------")

IP = "127.0.0.1"
PORT = 8081
c = Client(IP, PORT)
s = Seq()
s.read_fasta('../P2/FRAT1.txt')
count = 0
i = 0
while i < len(s.strbases) and count < 5:
    fragment = s.strbases[i:i + 10]
    count += 1
    i += 10
    print(c.talk(fragment))
Ejemplo n.º 14
0
from P2.Client0 import Client

PRACTICE = 2
EXERCISE = 1

print(f"-----| Practice {PRACTICE}, Exercise {EXERCISE} |------")

IP = "127.0.0.1"
PORT = 8081
c = Client(IP, PORT)
c.advanced_ping()
c.ping()
print(f"IP: {c.ip}, {c.port}")