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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 7, 20262026-06-07T03:26:17+00:00 2026-06-07T03:26:17+00:00

I am using these two programs to communicate between two of my computers, one

  • 0

I am using these two programs to communicate between two of my computers, one that I am ssh’d into and I am not returning anything on either side. It just runs without sending anything

client

import sys
from socket import socket, AF_INET, SOCK_DGRAM

SERVER_IP   = '127.0.0.1'
PORT_NUMBER = 5000
SIZE = 1024
print ("Test client sending packets to IP {0}, via port {1}\n".format(SERVER_IP, PORT_NUMBER))

mySocket = socket( AF_INET, SOCK_DGRAM )

while True:
        mySocket.sendto('cool',(SERVER_IP,PORT_NUMBER))
sys.exit()

server

from socket import socket, gethostbyname, AF_INET, SOCK_DGRAM
import sys
PORT_NUMBER = 5000
SIZE = 1024

hostName = gethostbyname( '0.0.0.0' )

mySocket = socket( AF_INET, SOCK_DGRAM )
mySocket.bind( (hostName, PORT_NUMBER) )

print ("Test server listening on port {0}\n".format(PORT_NUMBER))

while True:
        (data,addr) = mySocket.recvfrom(SIZE)
        print data
sys.ext()

What could I be doing wrong?

  • 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-07T03:26:20+00:00Added an answer on June 7, 2026 at 3:26 am

    The problem is in the address of your client:

    SERVER_IP   = '127.0.0.1'
    

    You are connecting to the local machine and sending data, while your server is sitting on a different ip. You need to connect to either the servers ip or hostname.

    You can verify this by making the client connect first (and fail if it cant)

    ...
    
    import time
    
    mySocket = socket( AF_INET, SOCK_DGRAM )
    mySocket.connect((SERVER_IP,PORT_NUMBER))
    
    while True:
            mySocket.send(b'cool')
            time.sleep(.5)
    

    Update from comments

    Because you are on a wifi connection, that implies that both these machine are on the local network. You need to find the LAN ip address of the server, to specify it as the target.

    Command-line approach to finding your IP

    • OSX/Linux: ifconfig
    • Windows: ipconfig /all
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm using dbus to communicate two programs. One creates a large image and it
What is the difference between these two: font-style:italic font-style:oblique I tried using the W3Schools
I have two programs- First one being a C program that writes in to
I'm using Python 3. I've written two programs. One loops through a csv file
I want to combine two programs into a single executable. One is an open
I am using these two functions in order to rotate my objects in my
t = Time.now d = 10.minutes.from_now Using these two variables, how do I output
I have two tables (using table variables for illustration. You can run these directly
On ubuntu 10.10 I accidentally added to repository two programs that had the goal
I have two programs written in C++ that use Winsock. They both accept TCP

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.