Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8564275
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 11, 20262026-06-11T17:09:41+00:00 2026-06-11T17:09:41+00:00

I have just started learning python and i was wondering how i would get

  • 0

I have just started learning python and i was wondering how i would get the client to execute a function on the server and get some response

Here is my server code

import socket

serversocket = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
serversocket.bind(('localhost', 8089)) 
serversocket.listen(5)

while True:
    connection, address = serversocket.accept()
    buf = connection.recv(64)
    if len(buf)> 0:
        print(buf)
        break

input('press enter')

This is the client code

import socket

clientsocket = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
clientsocket.connect(('localhost', 8089)) 
data = 'lorem ipsum'
clientsocket.send(data.encode())
input('press enter')

and this is the function

def addme(x,y):
    return x + y

print (addme(6,4))

Supposing i have the function addme() on the server,would it be possible to call it from the client and the response displayed to the client?.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-11T17:09:42+00:00Added an answer on June 11, 2026 at 5:09 pm

    If you simply want to call functions you should check out XMLRPC. Simple and easy, here’s the example from the python documentation.

    # Server code
    import xmlrpclib
    from SimpleXMLRPCServer import SimpleXMLRPCServer
    
    def is_even(n):
        return n%2 == 0
    
    server = SimpleXMLRPCServer(("localhost", 8000))
    print "Listening on port 8000..."
    server.register_function(is_even, "is_even")
    server.serve_forever()
    
    
    # Client code
    import xmlrpclib
    
    proxy = xmlrpclib.ServerProxy("http://localhost:8000/")
    print "3 is even: %s" % str(proxy.is_even(3))
    print "100 is even: %s" % str(proxy.is_even(100))
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I just started using/learning Python and have some questions. I have a text file
I have just started learning python/matplotlib/basemap and could really use some help. How do
Just started learning python (3.2) and have a question. I have created a some
I have just started learning python version 3 and trying to create a file
I have just started learning Lucene and would like to use it for indexing
Just started learning PySide and is having problem with QTimer I have this #!/usr/bin/python
I have just started learning python and am getting caught up. I come from
I have just started learning OpenGL ES 2.0, during the process I met some
I just started learning Python today. I have a list: [text:u'Oranges', text:u'Apples', empty:'', empty:'']
We just started learning about class inheritance and attribute lookup in python. I have

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.