Guest User

Untitled

a guest
Sep 22nd, 2018
99
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.70 KB | None | 0 0
  1. #!/usr/bin/python           # This is server.py file
  2.  
  3. import socket               # Import socket module
  4. from marshal_function_converter import *
  5.  
  6. def funkcija():
  7.     print("Ovo je funkcija preneta preko mreze\n")
  8.  
  9.  
  10. s = socket.socket()         # Create a socket object
  11. host = socket.gethostname() # Get local machine name
  12. port = 12345                # Reserve a port for your service.
  13. s.bind((host, port))        # Bind to the port
  14. k=function_to_string(funkcija)
  15.  
  16. s.listen(5)                 # Now wait for client connection.
  17. while True:
  18.    c, addr = s.accept()     # Establish connection with client.
  19.    print('Got connection from', addr)
  20.    c.send(k)
  21.    c.close()                # Close the connection
Add Comment
Please, Sign In to add comment