0

I've embedded python 2.7.1 into a C++ based app (marmalade)

running the example from: https://docs.python.org/2/library/socket.html

input

import socket
socket.getaddrinfo("www.python.org", 80, 0, 0, socket.SOL_TCP)

return

[(2, 3, 3, '', ('23.235.47.175', 0))]

DEBUG:
SOCKET: s3eInetAton: 'www.python.org'
SOCKET: s3eInetLookup: 'www.python.org'
SOCKET: s3eInetLookup (synchronous): done DNS: '23.235.47.175:0'
IWCRT: gethostbyname www.python.org -> 4a700360

However it should be like this, with a port not equal to zero

[(2, 1, 6, '', ('xx.xx.xx.xx', 80)]

Same with getaddrinfo:

input

import sys, socket

result = socket.getaddrinfo("python.org", None, 0, socket.SOCK_STREAM)

for item in result:
    print (item[4])

return

('140.211.10.69', 0)

('xx.xx.xx.xx', 80)

still no port


  • I've run the script outside of the home directory
  • I've combed through pyconfig.h to see if there are any settings are missing (that I see)
  • I've searched for a list of common python socket settings no where to be found ( you'd think it would be easy )

any ideas on what could cause this?

flow
  • 571
  • 1
  • 4
  • 16

1 Answers1

0

I don't think getaddrinfo() or gethostbyname() returns ports along with IP. You can check the following link getaddrinfo() and RFC-2553.

Naseef Chowdhury
  • 2,357
  • 3
  • 28
  • 52