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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T06:48:22+00:00 2026-06-15T06:48:22+00:00

Some advice was given here Python Sockets use function instead of global socket call

  • 0

Some advice was given here

Python Sockets use function instead of global socket call

and I thought it was working but now seems to not be any ideas on how to make the following code work?

def testMethod():
    socks = {}
    socks['i'] = createConnection(host, port)
    socks['i'].send("Hello  world")
    print "Sent Hello World"

This is the error message I get

'int' object has no attribute 'send'

*cheers

and ty for any advice

  • 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-15T06:48:23+00:00Added an answer on June 15, 2026 at 6:48 am

    The problem is in your createConnection function. It is returning an int rather than a socket. Can you share your implementation of createConnection?

    To make this more answer like:

    In your case, createConnection is returning an integer, a socket handle perhaps, but I’m guessing because the implementation isn’t available.

    the method should look something like

    import socket
    def createConnetion(host, port):
      sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
      sock.connect((host, port))
      return sock
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I followed the advice given here in several posts on how to declare global
I would really like some advice here, to give some background info I am
I need some advice regarding which database I should use. I want to create
Could someone prove to me that the advice given here (copied below) regarding removing
I am facing a situation here and would like some feedback or advice. I
I have just merged two repositories following advice given here . Since both repositories
Can someone give me some advice on this? I am reading in an old
after some advice regarding a problem i am getting using a linux based piece
I need some advice on how to successfully update mutiple rows in my database
I need some advice. I’m building an app that has a sequence of 4

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.