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 6877581
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T04:37:02+00:00 2026-05-27T04:37:02+00:00

I am trying to develop a mixed protocol which can return a raw response

  • 0

I am trying to develop a mixed protocol which can return a raw response or a Line Based response based on the request.
My code looks like

class Receiver(LineReceiver):
def lineReceived(self, line):
    (command, args) = self._parse_command(line)
    result = self.exec_command(command, args) #Secret sauce returns list or blob.
    if  isinstance(result, basestring): # won't work in 3.0 ; least of my worries.
        self.sendLine(str(len(result))) # Sends no. of bytes as a line.
        self.transport.write(result)   #followed by bytes. This is not received by the client.
        self.transport.loseConnection()
    else:
        no_lines = len(result)
        self.sendLine(str(no_lines)) 
        for r in result:
            self.sendLine(str(r))

In the above code transport.write(…) does not send across any data to the client.
How can I fix this.

  • 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-05-27T04:37:03+00:00Added an answer on May 27, 2026 at 4:37 am

    The transport.write call will send the data to the client. If the client is poorly written, it may lose it because the connection closes immediately after the data is sent. There are many other possible ways the client could fail, too, but there’s no way to know what’s actually happening since the client code isn’t part of the question.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm trying to develop a new application based on the standard Utility template, which
I am trying to develop an XSD for some XML that looks roughly like
I am trying to develop everything in sharepoint as features so I can easily
I'm trying to develop a web based digital asset management application. I'm planning to
I am trying to develop programs which will work for nokia mobile phones. I
Am trying to develop a windows service which listens to a rabbitMQ listener and
I'm trying to develop a very simple app that displays like a slideshow of
I am trying to develop Help Bar in HTML for which i am using
I'm trying to develop a XMPP Proxy which will be in the middle of
I am trying to develop popup message box which shows warning to user and

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.