
Security News
New Website “Is It Really FOSS?” Tracks Transparency in Open Source Distribution Models
A new site reviews software projects to reveal if they’re truly FOSS, making complex licensing and distribution models easy to understand.
High-level Ruby socket library with support for TCP, UDP, and SSL sockets.
Implements thread-safe timeouts using asynchronous I/O and high-precision monotonic timers.
By default, Ruby sockets do not provide a built-in timeout mechanism. The only timeout mechanism provided by the language leverages timeout.rb, which uses unsafe multithreaded behaviors to implement timeouts.
While Socketry provides a synchronous, blocking API similar to Ruby's own
TCPSocket
and UDPSocket
classes, behind the scenes it uses non-blocking I/O
to implement thread-safe timeouts.
Add this line to your application's Gemfile:
gem "socketry"
And then execute:
$ bundle
Or install it yourself as:
$ gem install socketry
Below is a basic example of how to use Socketry to make an HTTPS request:
require "socketry"
socket = Socketry::SSL::Socket.connect("github.com", 443)
socket.writepartial("GET / HTTP/1.0\r\nHost: github.com\r\n\r\n")
p socket.readpartial(1024)
TCP, SSL, and UDP servers and sockets also available.
Please see the Socketry wiki for more detailed documentation and usage notes.
YARD API documentation is also available.
This library aims to support and is tested against the following Ruby versions:
If something doesn't work on one of these versions, it's a bug.
This library may inadvertently work (or seem to work) on other Ruby versions, however support will only be provided for the versions listed above.
If you would like this library to support another Ruby version or implementation, you may volunteer to be a maintainer. Being a maintainer entails making sure all tests run and pass on that implementation. When something breaks on your implementation, you will be responsible for providing patches in a timely fashion. If critical issues for a particular implementation exist at the time of a major release, support for that Ruby version may be dropped.
Copyright (c) 2016 Tony Arcieri. Distributed under the MIT License. See LICENSE.txt for further details.
FAQs
Unknown package
We found that socketry demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
A new site reviews software projects to reveal if they’re truly FOSS, making complex licensing and distribution models easy to understand.
Security News
Astral unveils pyx, a Python-native package registry in beta, designed to speed installs, enhance security, and integrate deeply with uv.
Security News
The Latio podcast explores how static and runtime reachability help teams prioritize exploitable vulnerabilities and streamline AppSec workflows.