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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T01:15:30+00:00 2026-05-28T01:15:30+00:00

I have a problem with sending urgent data in python via TCP. I have

  • 0

I have a problem with sending urgent data in python via TCP.

I have studied the structure of TCP header and the out-of-band data transfer mechanism, but I still can’t understand how to implement this..

simple server:

#default steps
s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
s.bind((TCP_IP, TCP_PORT))
s.listen(1)
conn,addr = s.accept()
...
#oob
conn.send('!',MSG_OOB)
...

simple client:

...
data = conn.recv(BUFFER_SIZE,MSG_OOB)

OK, data received.

But how can I indicate that OOB information has come to client when i send data in cycle?

For example:

serverFile = open(serverPath, 'rb')
    while True:
        fileBytes = serverFile.read(1000)
        if not fileBytes: break;
        try:
            i += 1
            if i % 1000 == 0:
                print 'sending urgent..'
                conn.send('!',MSG_OOB)
            conn.send(fileBytes)
        except socket.error, (value, message):
            if conn:
                conn.close()
            serverFile.close()
            print 'Error while sending data : error code - ' + str(value) + '; message: ' + message
            exit(1)
    serverFile.close()

If client tries to receive all data with ‘data = conn.recv(BUFFER_SIZE,MSG_OOB)’ – nothing works.
I have not found any way to use SELECT or smth like SIGURG to solve problem.

  • 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-28T01:15:30+00:00Added an answer on May 28, 2026 at 1:15 am

    Perhaps it will help someone (obvious but not particularly efficient solution):
    client:

    #catching urgent data
        s.settimeout(2)
        try:
            data = s.recv(BUFFER_SIZE,MSG_OOB)
        except socket.error, value: #(value,message):
            #s.settimeout(5)
            data = None
        if data:
            print 'urgent ' + str(data)
        else:
            #recv usual data
            data = s.recv(BUFFER_SIZE)
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have problem when I try insert some data to Informix TEXT column via
I have problem with sending objects via TCPClient. At first, I serialize them into
I have a problem when sending a form via email using the PHP Mail
I have a problem sending a registration email via zend_mail. The mail is transmitted
I have problem while sending messages from android to PC. Messages are send when
greetings all i have a problem that when sending an email from the server
I have problem sending emails, i checked the email sending error logs, and I
i have problem in sending zip file in network.. all other formats i am
I have a problem sending plain text emails using PHPMailer. I have text that
I have a problem sending images through the PHP mail function. I have used

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.