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

  • Home
  • SEARCH
  • 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 8687811
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 12, 20262026-06-12T23:12:08+00:00 2026-06-12T23:12:08+00:00

I have a strange issue with the TCP JSON-RPC server I’ve created in Python-2.7.

  • 0

I have a strange issue with the TCP JSON-RPC server I’ve created in Python-2.7. I used the following code to build the server:

https://github.com/joshmarshall/jsonrpclib

I am communicating client to server from within the same local network. In the console window, I can connect to and run commands against the server from within Python. All is well there.

However, when I try to send JSON strings from a mobile app (in this case an iPad) I get an error on the server. I have also downloaded this tool in an attempt to send the JSON strings: http://www.simplecomtools.com/productcart/pc/downloads/tcptesttool.zip but with the same error result. The server is reporting a “Bad request syntax” error. I’ve tried several different strings – the displayed errors are:

192.168.1.107 – – [13/Oct/2012 09:48:17] code 400, message Bad request syntax (“{‘jsonrpc’:’2.0′,’method’:’add’,’params’:[3,6],’id’:’8′}”)
192.168.1.107 – – [13/Oct/2012 09:48:17] “{‘jsonrpc’:’2.0′,’method’:’add’,’params’:[3,6],’id’:’8′}” 400 –

192.168.1.107 – – [13/Oct/2012 09:49:44] code 400, message Bad request syntax (‘{“jsonrpc”:”2.0″,”method”:”add”,”params”:[3,6],”id”:”8″}’)
192.168.1.107 – – [13/Oct/2012 09:49:44] “{“jsonrpc”:”2.0″,”method”:”add”,”params”:[3,6],”id”:”8″}” 400 –

192.168.1.107 – – [13/Oct/2012 09:50:49] code 400, message Bad request syntax (‘{“jsonrpc”:”2.0″,”method”:”add”,”params”:{“x”:3,”y”:6},”id”:”8″}’)
192.168.1.107 – – [13/Oct/2012 09:50:49] “{“jsonrpc”:”2.0″,”method”:”add”,”params”:{“x”:3,”y”:6},”id”:”8″}” 400 –

192.168.1.107 – – [13/Oct/2012 17:11:59] code 400, message Bad request syntax (“{‘jsonrpc’:’2.0′, ‘method’:’add’, ‘params’:{‘x’:3,’y’:6}, ‘id’:8}”)
192.168.1.107 – – [13/Oct/2012 17:11:59] “{‘jsonrpc’:’2.0′, ‘method’:’add’, ‘params’:{‘x’:3,’y’:6}, ‘id’:8}” 400 –

I really have no idea why the server would think the request syntax is bad, and I feel a little silly even asking the question. Any ideas on what I could try to solve the syntax error?

  • 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-12T23:12:10+00:00Added an answer on June 12, 2026 at 11:12 pm

    In message 1 and 4, your client is not actually sending JSON; it is using ' to denote string boundaries, instead of ". While single quotes are supported by some JSON implementations, they are invalid according to the standard. Correct your client implementation to send actual JSON with "-delimited strings.

    But the main problem is that you’re not wrapping your messages into HTTP POST requests, but sending them raw. A proper JSONRPC request looks like:

    POST / HTTP/1.0
    Content-Length: 71
    
    {"jsonrpc": "2.0", "params": [3, 6], "id": "er5qtdbz", "method": "pow"}
    

    , but you’re sending just the last line.

    In Python, you can send a valid request with the following example program:

    import json
    try:
        from urllib.request import urlopen
    except ImportError: # Python<3
        from urllib2 import urlopen
    
    req = {"jsonrpc":"2.0","method":"add","params":[3,6],"id":0}
    req_data = json.dumps(req).encode('utf-8')
    u = urlopen('http://localhost:8080/', req_data)
    print(u.read())
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a strange issue from a client in that our code, which they
Hello have following strange issue, can vertical center the menu text if it's one
Have following strange issue, have 7 lines (same classes) but after 2 lines it's
I have a strange issue with my code I can't seem to figure out.
I have some strange issue with querying SQL Server from django. When I query
I have a strange issue. I created a simple app in haskell with sdl,
I have a strange issue specific to my Django deployment under Python 2.6 +
I have a strange issue going on. It may be server related, but I
I have a strange issue happening. I have some code which must do an
I have a strange issue in a datalist <asp:DataList ID=dl RepeatColumns=8 runat=server GridLines=None OnItemDataBound=dl_idb

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.