Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

socket.socket.recv vs. socks.socksocket.recv w/o proxy #163

Open
totifra opened this issue Aug 4, 2022 · 0 comments
Open

socket.socket.recv vs. socks.socksocket.recv w/o proxy #163

totifra opened this issue Aug 4, 2022 · 0 comments

Comments

@totifra
Copy link

totifra commented Aug 4, 2022

Hi there,

while monkeypatching a 3rd-party module, I observed a different behavior when calling socket.socket.recv(0) and socks.socksocket.recv(0). The former call will return b'' but the latter one will just stuck and never return.

The following code snippet reproduces this issue for me:

import socket
import socks

addr = ("127.0.0.1", 80)

s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
s.connect(addr)
r = s.recv(0)
print(r)

s1 = socks.socksocket(socket.AF_INET, socket.SOCK_STREAM)
s1.connect(addr)
r1 = s1.recv(0)  # never returns!
print(r1)

I would have expected similar behavior at least when no proxy is used. But I also do not understand what the idea of a recv(0) is, since I have no experience using sockets. So maybe this is as expected?!

(Python 3.9.12, PySocks 1.7.1)

Thanks in advance
Thomas

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant