import socket
import sys
from RemoteFunctionCaller import *
from SocketNetworker import SocketNetworker

HOST = 'localhost'    # The remote host
PORT = 8553           # The same port as used by the server
s = None
for res in socket.getaddrinfo(HOST, PORT, socket.AF_UNSPEC, socket.SOCK_STREAM):
    af, socktype, proto, canonname, sa = res
    try:
        s = socket.socket(af, socktype, proto)
    except OSError as msg:
        s = None
        continue
    try:
        s.connect(sa)
    except OSError as msg:
        s.close()
        s = None
        continue
    break
if s is None:
    print('could not open socket')
    sys.exit(1)

nw = SocketNetworker(s)
caller = RemoteFunctionCaller(nw)

try:
    caller.setData("test", "success")
    print(caller.getData("test", default="failish"))
except TimeoutError:
    print("Timed out.")

nw.close()

import socket
import sys
from RemoteFunctionCaller import *
from SocketNetworker import SocketNetworker

HOST = 'localhost'    # The remote host
PORT = 8553           # The same port as used by the server
s = None
for res in socket.getaddrinfo(HOST, PORT, socket.AF_UNSPEC, socket.SOCK_STREAM):
    af, socktype, proto, canonname, sa = res
    try:
        s = socket.socket(af, socktype, proto)
    except OSError as msg:
        s = None
        continue
    try:
        s.connect(sa)
    except OSError as msg:
        s.close()
        s = None
        continue
    break
if s is None:
    print('could not open socket')
    sys.exit(1)

nw = SocketNetworker(s)
caller = RemoteFunctionCaller(nw)

try:
    print(caller.SharedClientDataStore__set("test", "success"))
    print(caller.SharedClientDtaStore__get("test", default="failish"))
except TimeoutError:
    print("Timed out.")

nw.close()

Update call method in test client
Update call method in test client

  import socket
  import sys
  from RemoteFunctionCaller import *
  from SocketNetworker import SocketNetworker
  
  HOST = 'localhost'    # The remote host
  PORT = 8553           # The same port as used by the server
  s = None
  for res in socket.getaddrinfo(HOST, PORT, socket.AF_UNSPEC, socket.SOCK_STREAM):
      af, socktype, proto, canonname, sa = res
      try:
          s = socket.socket(af, socktype, proto)
      except OSError as msg:
          s = None
          continue
      try:
          s.connect(sa)
      except OSError as msg:
          s.close()
          s = None
          continue
      break
  if s is None:
      print('could not open socket')
      sys.exit(1)
  
  nw = SocketNetworker(s)
  caller = RemoteFunctionCaller(nw)
  
  try:
-     caller.setData("test", "success")
+     print(caller.SharedClientDataStore__set("test", "success"))
-     print(caller.getData("test", default="failish"))
+     print(caller.SharedClientDtaStore__get("test", default="failish"))
  except TimeoutError:
      print("Timed out.")
  
  nw.close()
  
Update call method in test client
## Code Before:
import socket
import sys
from RemoteFunctionCaller import *
from SocketNetworker import SocketNetworker

HOST = 'localhost'    # The remote host
PORT = 8553           # The same port as used by the server
s = None
for res in socket.getaddrinfo(HOST, PORT, socket.AF_UNSPEC, socket.SOCK_STREAM):
    af, socktype, proto, canonname, sa = res
    try:
        s = socket.socket(af, socktype, proto)
    except OSError as msg:
        s = None
        continue
    try:
        s.connect(sa)
    except OSError as msg:
        s.close()
        s = None
        continue
    break
if s is None:
    print('could not open socket')
    sys.exit(1)

nw = SocketNetworker(s)
caller = RemoteFunctionCaller(nw)

try:
    caller.setData("test", "success")
    print(caller.getData("test", default="failish"))
except TimeoutError:
    print("Timed out.")

nw.close()

## Instruction:
Update call method in test client
## Code After:
import socket
import sys
from RemoteFunctionCaller import *
from SocketNetworker import SocketNetworker

HOST = 'localhost'    # The remote host
PORT = 8553           # The same port as used by the server
s = None
for res in socket.getaddrinfo(HOST, PORT, socket.AF_UNSPEC, socket.SOCK_STREAM):
    af, socktype, proto, canonname, sa = res
    try:
        s = socket.socket(af, socktype, proto)
    except OSError as msg:
        s = None
        continue
    try:
        s.connect(sa)
    except OSError as msg:
        s.close()
        s = None
        continue
    break
if s is None:
    print('could not open socket')
    sys.exit(1)

nw = SocketNetworker(s)
caller = RemoteFunctionCaller(nw)

try:
    print(caller.SharedClientDataStore__set("test", "success"))
    print(caller.SharedClientDtaStore__get("test", default="failish"))
except TimeoutError:
    print("Timed out.")

nw.close()
