Skip to content

Commit

Permalink
better formatting of raw send, receive
Browse files Browse the repository at this point in the history
  • Loading branch information
bobjacobsen committed Feb 15, 2024
1 parent e6ca6fb commit 24fcc02
Show file tree
Hide file tree
Showing 8 changed files with 16 additions and 16 deletions.
4 changes: 2 additions & 2 deletions example_datagram_transfer.py
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ def usage():


def sendToSocket(string):
print(" SR: "+string)
print(" SR: "+string.strip())
s.send(string)


Expand Down Expand Up @@ -143,6 +143,6 @@ def datagramWrite():
# process resulting activity
while True:
received = s.receive()
print(" RR: {}".format(received))
print(" RR: {}".format(received.strip()))
# pass to link processor
canPhysicalLayerGridConnect.receiveString(received)
4 changes: 2 additions & 2 deletions example_frame_interface.py
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ def usage():


def sendToSocket(string):
print(" SR: {}".format(string))
print(" SR: {}".format(string.strip()))
s.send(string)


Expand All @@ -80,6 +80,6 @@ def printFrame(frame):
# display response - should be RID from nodes
while True:
received = s.receive()
print(" RR: {}".format(received))
print(" RR: {}".format(received.strip()))
# pass to link processor
canPhysicalLayerGridConnect.receiveString(received)
4 changes: 2 additions & 2 deletions example_memory_transfer.py
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ def usage():


def sendToSocket(string):
print(" SR: {}".format(string))
print(" SR: {}".format(string.strip()))
s.send(string)


Expand Down Expand Up @@ -159,6 +159,6 @@ def memoryRead():
# process resulting activity
while True:
received = s.receive()
print(" RR: {}".format(received))
print(" RR: {}".format(received.strip()))
# pass to link processor
canPhysicalLayerGridConnect.receiveString(received)
4 changes: 2 additions & 2 deletions example_message_interface.py
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ def usage():


def sendToSocket(string):
print(" SR: {}".format(string))
print(" SR: {}".format(string.strip()))
s.send(string)


Expand Down Expand Up @@ -99,6 +99,6 @@ def printMessage(msg):
# process resulting activity
while True:
received = s.receive()
print(" RR: {}".format(received))
print(" RR: {}".format(received.strip()))
# pass to link processor
canPhysicalLayerGridConnect.receiveString(received)
4 changes: 2 additions & 2 deletions example_node_implementation.py
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ def usage():


def sendToSocket(string):
print(" SR: {}".format(string))
print(" SR: {}".format(string.strip()))
s.send(string)


Expand Down Expand Up @@ -143,6 +143,6 @@ def memoryReadFail(memo):
# process resulting activity
while True:
input = s.receive()
print(" RR: "+input)
print(" RR: "+input.strip())
# pass to link processor
canPhysicalLayerGridConnect.receiveString(input)
4 changes: 2 additions & 2 deletions example_remote_nodes.py
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ def usage():
print("RR, SR are raw socket interface receive and send; RL, SL are link (frame) interface")

def sendToSocket(string) :
if trace : print(" SR: "+string)
if trace : print(" SR: "+string.strip())
s.send(string)

def receiveFrame(frame) :
Expand Down Expand Up @@ -122,7 +122,7 @@ def receiveLoop() :
canPhysicalLayerGridConnect.physicalLayerUp()
while True:
input = s.receive()
if trace : print(" RR: "+input)
if trace : print(" RR: "+input.strip())
# pass to link processor
canPhysicalLayerGridConnect.receiveString(input)
import threading
Expand Down
4 changes: 2 additions & 2 deletions example_string_interface.py
Original file line number Diff line number Diff line change
Expand Up @@ -59,8 +59,8 @@ def usage():
# elicit response
AME = ":X10702001N;"
s.send(AME)
print("SR: {}".format(AME))
print("SR: {}".format(AME.strip()))

# display response - should be RID from node(s)
while True: # have to kill this manually
print("RR: {}".format(s.receive()))
print("RR: {}".format(s.receive().strip()))
4 changes: 2 additions & 2 deletions example_tcp_message_interface.py
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ def usage():


def sendToSocket(data):
print(" SR: {}".format(data))
print(" SR: {}".format(data.strip()))
s.send(data)

def printMessage(msg):
Expand All @@ -88,6 +88,6 @@ def printMessage(msg):
# process resulting activity
while True:
received = s.receive()
print(" RR: {}".format(received))
print(" RR: {}".format(received.strip()))
# pass to link processor
tcpLinklayer.receiveListener(received)

0 comments on commit 24fcc02

Please sign in to comment.