GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — Issue with socket in Cygwin · Issue #267 · python-xlib/python-xlib

Issue with socket in Cygwin #267

New issue
Copy link
New issue
Copy link
Open
Open
Issue with socket in Cygwin#267
Copy link

Description

@robertschulze
robertschulze
opened on Jul 27, 2023
Issue body actions

Until Python 3.6.9 Xlib is working in Cygwin. However, now having upgraded to Python 3.6.13 I noticed that Xlib is now unable to connect to X11. The same error appears for Python 3.8 and 3.9. After overwriting _socket.cpython-36m-x86_64-cygwin.dll with the one from 3.6.9 Xlib is working again, so my guess is that this is due to some change in the socket module.

I debugged the issue a bit and found this to be working in Python 3.6.9

Python 3.6.9 (default, Jul 21 2019, 14:33:59)
[GCC 7.4.0] on cygwin
Type "help", "copyright", "credits" or "license" for more information.
>>> display = ":7"
>>> data = b'l\x00\x0b\x00\x00\x00\x12\x00\x10\x00\x00\x00MIT-MAGIC-COOKIE-1\x00\x00\xc5\xc1C\xc1Y}\xe6\x1e\x88P\xab\x98\xd0\x91<%'
>>> import select
>>> from Xlib.support import lock, connect
>>> name, protocol, host, displayno, screenno = connect.get_display(display)
>>> socket = connect.get_socket(name, protocol, host, displayno)
>>> i = socket.send(data)
>>> select.select([socket], [], [], None)
([<socket.socket fd=3, family=AddressFamily.AF_UNIX, type=SocketKind.SOCK_STREAM, proto=0, raddr=/tmp/.X11-unix/X7>], [], [])
>>> socket.recv(512)
b'\x01\x00\x0b\x00\x00\x00:\x07\xd0\xab\xb5\x00\x00\x00`\x00\xff\xff\x1f\x00\x00\x01\x00\x00\x18\x00\xff\xff\x01\x06\x00\x00  \x08\xff\x00\x00\x00\x00The Cygwin Ports project

while in Python 3.6.13 the same commands yield a Connection reset

Python 3.6.13 (default, Feb 16 2021, 07:46:47)
[GCC 10.2.0] on cygwin
Type "help", "copyright", "credits" or "license" for more information.
...
>>> socket.recv(512)
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
ConnectionResetError: [Errno 104] Connection reset by peer

Any help would be much appreciated!

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions

      You are visitor 01402503 — GeezerVison does not store the pages you look up.
      Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.