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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 11, 20262026-05-11T16:41:51+00:00 2026-05-11T16:41:51+00:00

i have to create connecting server<=>client. I use this code: Server: import socket HOST

  • 0

i have to create connecting server<=>client. I use this code:
Server:

import socket

HOST = 'localhost'
PORT = 50007      
s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
s.bind((HOST, PORT))
s.listen(1)
conn, addr = s.accept()
print 'Connected by', addr
while 1:
    data = conn.recv(1024)
    if not data: break
    conn.send(data)
conn.close()

Client:

import socket

HOST = 'localhost'   
PORT = 50007             
s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
s.connect((HOST, PORT))
s.send('Hello, world')
data = s.recv(1024)
s.close()
print 'Received', repr(data)

It works fine! But if server is created on the computer which hasn’t router.
If u have router, before server creating you should open 50007 port on your modem. How can i create server on all computers without port enabling? Torrent-clients do it somehow.
Thanks.

  • 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-11T16:41:52+00:00Added an answer on May 11, 2026 at 4:41 pm

    The question is a little confusing, but I will try to help out. Basically, if the port (50007) is blocked on the server machine by a firewall, you will NOT be able to make a tcp connection to it from the client. That is the purpose of the firewall. A lot of protocols (SIP and bittorrent for example) do use firewall and NAT navigation strategies, but that is a complex subject that you can get more information on here. You will note that to use bittorrent effectively, you have to enable port forwarding for NAT and unblock port ranges for firewalls. Also, bittorrent uses tcp connections for most data transfer. Here is the takeaway:

    First, note that there are two types of connections that the BitTorrent program must make:

    • Outbound HTTP connections to the tracker, usually on port 6969.
    • Inbound and outbound connections to the peer machines, usually on port 6881 and up.
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Ask A Question

Stats

  • Questions 129k
  • Answers 129k
  • Best Answers 0
  • User 1
  • Popular
  • Answers
  • Editorial Team

    How to approach applying for a job at a company ...

    • 7 Answers
  • Editorial Team

    How to handle personal stress caused by utterly incompetent and ...

    • 5 Answers
  • Editorial Team

    What is a programmer’s life like?

    • 5 Answers
  • Editorial Team
    Editorial Team added an answer How about this? SELECT CustomerID, MAX(Date) FROM Purchase GROUP BY… May 12, 2026 at 5:56 am
  • Editorial Team
    Editorial Team added an answer I think you have to run a COUNT() query on… May 12, 2026 at 5:56 am
  • Editorial Team
    Editorial Team added an answer I've never done this, but I my first guess would… May 12, 2026 at 5:56 am

Related Questions

i have to create connecting server<=>client. I use this code: Server: import socket HOST
Hey guys, I have a problem (again). This time I am trying to use
How do you construct a DbConnection based on a provider name ? Sample provider
I have a sql server table with 2 fields, ID (primary key) and Name
I have SQL table that has a varchar(8) column that occasionally has binary data

Trending Tags

analytics british company computer developers django employee employer english facebook french google interview javascript language life php programmer programs salary

Top Members

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.