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

threadsafe #15

Open
tigris opened this issue Aug 29, 2012 · 3 comments
Open

threadsafe #15

tigris opened this issue Aug 29, 2012 · 3 comments

Comments

@tigris
Copy link

tigris commented Aug 29, 2012

Would love if this could be threadsafe, often want a few tcp sockets open at same time, some via socks and some not

@astro
Copy link
Owner

astro commented Aug 29, 2012

Propose an API.

Then it won't be a long shot for a commit.

@musybite
Copy link
Collaborator

@tigris socksify-ruby can do this, altough interface is ugly a bit. It's kind of undocumented feature.

require 'socksify'
addr = TCPSocket::SOCKSConnectionPeerAddress.new("<socks host>", <socks port>, "<peer host>")
s = TCPSocket.new(addr, <peer port>)
# Proceed as usual.

@kornate
Copy link

kornate commented May 3, 2023

Something like this would be nice:

require 'socksify'

# Create a new socksified connection
socksified_connection = Socksify::Connection.new(socks_host: "<socks host>", socks_port: <socks port>, peer_host: "<peer host>", peer_port: <peer port>)

# Use the connection as a regular TCPSocket
socksified_connection.write("data")
response = socksified_connection.read
socksified_connection.close

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

4 participants